Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1118)

Unified Diff: webrtc/modules/audio_coding/neteq/decoder_database.h

Issue 2021063002: NetEq decoder database: Don't keep track of sample rate for builtin decoders (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@decoder-samp-rate
Patch Set: explicit capture Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/decoder_database.h
diff --git a/webrtc/modules/audio_coding/neteq/decoder_database.h b/webrtc/modules/audio_coding/neteq/decoder_database.h
index 72b43df5b31792d7cc81dbf10e70925767694639..4169dc2b1b7d96f9ed2295c4ce546e8623ebb7fe 100644
--- a/webrtc/modules/audio_coding/neteq/decoder_database.h
+++ b/webrtc/modules/audio_coding/neteq/decoder_database.h
@@ -41,9 +41,10 @@ class DecoderDatabase {
// Class that stores decoder info in the database.
class DecoderInfo {
public:
+ DecoderInfo(NetEqDecoder ct, const std::string& nm);
DecoderInfo(NetEqDecoder ct,
const std::string& nm,
- int fs,
+ int sample_rate_hz,
AudioDecoder* ext_dec);
DecoderInfo(DecoderInfo&&);
~DecoderInfo();
@@ -55,14 +56,35 @@ class DecoderDatabase {
// always recreate it later if we need it.)
void DropDecoder() { decoder_.reset(); }
+ int SampleRateHz() const {
+ RTC_DCHECK_EQ(1, !!decoder_ + !!external_decoder + !!cng_decoder_);
+ return decoder_ ? decoder_->SampleRateHz()
+ : external_decoder ? external_decoder->sample_rate_hz
+ : cng_decoder_->sample_rate_hz;
+ }
+
const NetEqDecoder codec_type;
const std::string name;
- const int fs_hz;
- AudioDecoder* const external_decoder;
private:
const rtc::Optional<SdpAudioFormat> audio_format_;
std::unique_ptr<AudioDecoder> decoder_;
+
+ // Set iff this is an external decoder.
+ struct ExternalDecoder {
+ // TODO(kwiberg): Remove sample_rate_hz once we can trust all decoders to
+ // implement SampleRateHz().
+ int sample_rate_hz;
+ AudioDecoder* decoder;
+ };
+ const rtc::Optional<ExternalDecoder> external_decoder;
+
+ // Set iff this is a comfort noise decoder.
+ struct CngDecoder {
+ static rtc::Optional<CngDecoder> Create(NetEqDecoder ct);
+ int sample_rate_hz;
+ };
+ const rtc::Optional<CngDecoder> cng_decoder_;
};
// Maximum value for 8 bits, and an invalid RTP payload type (since it is
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/decoder_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698