Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/decoder_database.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/decoder_database.cc b/webrtc/modules/audio_coding/neteq/decoder_database.cc |
| index 27bc6d56970c9835300fc1cb398c387a6f03b220..3151301357cf2627008d8ee8f387feba6c1700dd 100644 |
| --- a/webrtc/modules/audio_coding/neteq/decoder_database.cc |
| +++ b/webrtc/modules/audio_coding/neteq/decoder_database.cc |
| @@ -95,7 +95,12 @@ bool DecoderDatabase::DecoderInfo::IsType(const std::string& name) const { |
| rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder> |
| DecoderDatabase::DecoderInfo::CngDecoder::Create(const SdpAudioFormat& format) { |
| if (STR_CASE_CMP(format.name.c_str(), "CN") == 0) { |
| - return rtc::Optional<CngDecoder>({format.clockrate_hz}); |
| + // CN has a 1:1 RTP clock rate to sample rate ratio. |
| + const int sample_rate_hz = format.clockrate_hz; |
| + RTC_DCHECK(sample_rate_hz == 8000 || sample_rate_hz == 16000 || |
| + sample_rate_hz == 32000 || sample_rate_hz == 48000); |
| + return rtc::Optional<DecoderDatabase::DecoderInfo::CngDecoder>( |
| + {sample_rate_hz}); |
| } else { |
| return rtc::Optional<CngDecoder>(); |
| } |
| @@ -138,6 +143,20 @@ int DecoderDatabase::RegisterPayload(uint8_t rtp_payload_type, |
| return kOK; |
| } |
| +int DecoderDatabase::RegisterPayload(int rtp_payload_type, |
| + const SdpAudioFormat& audio_format) { |
| + if (rtp_payload_type > 0x7f) { |
|
ossu
2016/09/28 14:12:28
Since rtp_payload_type is an int in this overload,
kwiberg-webrtc
2016/09/29 12:38:35
Done.
|
| + return kInvalidRtpPayloadType; |
| + } |
| + const auto ret = decoders_.insert(std::make_pair( |
| + rtp_payload_type, DecoderInfo(audio_format, decoder_factory_.get()))); |
| + if (ret.second == false) { |
| + // Database already contains a decoder with type |rtp_payload_type|. |
| + return kDecoderExists; |
| + } |
| + return kOK; |
| +} |
| + |
| int DecoderDatabase::InsertExternal(uint8_t rtp_payload_type, |
| NetEqDecoder codec_type, |
| const std::string& codec_name, |