| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ~DecoderInfo(); | 55 ~DecoderInfo(); |
| 56 | 56 |
| 57 // Get the AudioDecoder object, creating it first if necessary. | 57 // Get the AudioDecoder object, creating it first if necessary. |
| 58 AudioDecoder* GetDecoder() const; | 58 AudioDecoder* GetDecoder() const; |
| 59 | 59 |
| 60 // Delete the AudioDecoder object, unless it's external. (This means we can | 60 // Delete the AudioDecoder object, unless it's external. (This means we can |
| 61 // always recreate it later if we need it.) | 61 // always recreate it later if we need it.) |
| 62 void DropDecoder() const { decoder_.reset(); } | 62 void DropDecoder() const { decoder_.reset(); } |
| 63 | 63 |
| 64 int SampleRateHz() const { | 64 int SampleRateHz() const { |
| 65 if (IsDtmf()) { |
| 66 // DTMF has a 1:1 mapping between clock rate and sample rate. |
| 67 return audio_format_.clockrate_hz; |
| 68 } |
| 65 const AudioDecoder* decoder = GetDecoder(); | 69 const AudioDecoder* decoder = GetDecoder(); |
| 66 RTC_DCHECK_EQ(1, !!decoder + !!cng_decoder_); | 70 RTC_DCHECK_EQ(1, !!decoder + !!cng_decoder_); |
| 67 return decoder ? decoder->SampleRateHz() : cng_decoder_->sample_rate_hz; | 71 return decoder ? decoder->SampleRateHz() : cng_decoder_->sample_rate_hz; |
| 68 } | 72 } |
| 69 | 73 |
| 70 const SdpAudioFormat& GetFormat() const { return audio_format_; } | 74 const SdpAudioFormat& GetFormat() const { return audio_format_; } |
| 71 | 75 |
| 72 // Returns true if the decoder's format is comfort noise. | 76 // Returns true if the decoder's format is comfort noise. |
| 73 bool IsComfortNoise() const { | 77 bool IsComfortNoise() const { |
| 74 RTC_DCHECK_EQ(!!cng_decoder_, subtype_ == Subtype::kComfortNoise); | 78 RTC_DCHECK_EQ(!!cng_decoder_, subtype_ == Subtype::kComfortNoise); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 int active_decoder_type_; | 231 int active_decoder_type_; |
| 228 int active_cng_decoder_type_; | 232 int active_cng_decoder_type_; |
| 229 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_; | 233 mutable std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_; |
| 230 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 234 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
| 231 | 235 |
| 232 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); | 236 RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase); |
| 233 }; | 237 }; |
| 234 | 238 |
| 235 } // namespace webrtc | 239 } // namespace webrtc |
| 236 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ | 240 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DECODER_DATABASE_H_ |
| OLD | NEW |