Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1030)

Unified Diff: webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc

Issue 2024633002: AudioDecoder: New method SampleRateHz, + implementations for our codecs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add TODO fix PCM A U at 8 kHz Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
diff --git a/webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc b/webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
index 9757b4a0100674095353e9e20e43f986a1b3aba8..af164c4bb72b0b25525b3999f3e6887390a0b802 100644
--- a/webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
+++ b/webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.cc
@@ -16,6 +16,10 @@ namespace webrtc {
void AudioDecoderPcmU::Reset() {}
+int AudioDecoderPcmU::SampleRateHz() const {
+ return 8000;
+}
+
size_t AudioDecoderPcmU::Channels() const {
return num_channels_;
}
@@ -25,7 +29,7 @@ int AudioDecoderPcmU::DecodeInternal(const uint8_t* encoded,
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 @@ int AudioDecoderPcmU::PacketDuration(const uint8_t* encoded,
void AudioDecoderPcmA::Reset() {}
+int AudioDecoderPcmA::SampleRateHz() const {
+ return 8000;
+}
+
size_t AudioDecoderPcmA::Channels() const {
return num_channels_;
}
@@ -49,7 +57,7 @@ int AudioDecoderPcmA::DecodeInternal(const uint8_t* encoded,
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);

Powered by Google App Engine
This is Rietveld 408576698