| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 ~DecoderInfo(); | 50 ~DecoderInfo(); |
| 51 | 51 |
| 52 // Get the AudioDecoder object, creating it first if necessary. | 52 // Get the AudioDecoder object, creating it first if necessary. |
| 53 AudioDecoder* GetDecoder() const; | 53 AudioDecoder* GetDecoder() const; |
| 54 | 54 |
| 55 // Delete the AudioDecoder object, unless it's external. (This means we can | 55 // Delete the AudioDecoder object, unless it's external. (This means we can |
| 56 // always recreate it later if we need it.) | 56 // always recreate it later if we need it.) |
| 57 void DropDecoder() const { decoder_.reset(); } | 57 void DropDecoder() const { decoder_.reset(); } |
| 58 | 58 |
| 59 int SampleRateHz() const { | 59 int SampleRateHz() const { |
| 60 if (IsDtmf()) { |
| 61 // DTMF has a 1:1 mapping between clock rate and sample rate. |
| 62 return audio_format_.clockrate_hz; |
| 63 } |
| 60 const AudioDecoder* decoder = GetDecoder(); | 64 const AudioDecoder* decoder = GetDecoder(); |
| 61 RTC_DCHECK_EQ(1, !!decoder + !!cng_decoder_); | 65 RTC_DCHECK_EQ(1, !!decoder + !!cng_decoder_); |
| 62 return decoder ? decoder->SampleRateHz() : cng_decoder_->sample_rate_hz; | 66 return decoder ? decoder->SampleRateHz() : cng_decoder_->sample_rate_hz; |
| 63 } | 67 } |
| 64 | 68 |
| 65 const SdpAudioFormat& GetFormat() const { return audio_format_; } | 69 const SdpAudioFormat& GetFormat() const { return audio_format_; } |
| 66 | 70 |
| 67 // Returns true if the decoder's format is comfort noise. | 71 // Returns true if the decoder's format is comfort noise. |
| 68 bool IsComfortNoise() const { | 72 bool IsComfortNoise() const { |
| 69 RTC_DCHECK_EQ(!!cng_decoder_, subtype_ == Subtype::kComfortNoise); | 73 RTC_DCHECK_EQ(!!cng_decoder_, subtype_ == Subtype::kComfortNoise); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 int active_decoder_type_; | 224 int active_decoder_type_; |
| 221 int active_cng_decoder_type_; | 225 int active_cng_decoder_type_; |
| 222 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_; | 226 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_; |
| 223 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 227 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
| 224 | 228 |
| 225 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); | 229 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); |
| 226 }; | 230 }; |
| 227 | 231 |
| 228 } // namespace webrtc | 232 } // namespace webrtc |
| 229 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ | 233 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ |
| OLD | NEW |