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 |