AudioDecoder: New method SampleRateHz, + implementations for our codecs
This will let NetEq (and the factory, and every layer in between) keep
track of just the decoder, instead of decoder and sample rate.
BUG=webrtc:5801
Review-Url: https://codereview.webrtc.org/2024633002
Cr-Original-Commit-Position: refs/heads/master@{#12968}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 6c2eab34f8ff1f7a724622e3473858a4c0724bd8
diff --git a/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc b/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
index 9757b4a..af164c4 100644
--- a/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
+++ b/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
@@ -16,6 +16,10 @@
void AudioDecoderPcmU::Reset() {}
+int AudioDecoderPcmU::SampleRateHz() const {
+ return 8000;
+}
+
size_t AudioDecoderPcmU::Channels() const {
return num_channels_;
}
@@ -25,7 +29,7 @@
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) {
- RTC_DCHECK_EQ(sample_rate_hz, 8000);
+ RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
int16_t temp_type = 1; // Default is speech.
size_t ret = WebRtcG711_DecodeU(encoded, encoded_len, decoded, &temp_type);
*speech_type = ConvertSpeechType(temp_type);
@@ -40,6 +44,10 @@
void AudioDecoderPcmA::Reset() {}
+int AudioDecoderPcmA::SampleRateHz() const {
+ return 8000;
+}
+
size_t AudioDecoderPcmA::Channels() const {
return num_channels_;
}
@@ -49,7 +57,7 @@
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) {
- RTC_DCHECK_EQ(sample_rate_hz, 8000);
+ RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
int16_t temp_type = 1; // Default is speech.
size_t ret = WebRtcG711_DecodeA(encoded, encoded_len, decoded, &temp_type);
*speech_type = ConvertSpeechType(temp_type);