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

Unified Diff: webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.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/g722/audio_decoder_g722.cc
diff --git a/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc b/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
index 7676e90d9e4f9420f101aeb69b96daabe475680b..379293b748b043985488e180934c2dd5c9baf060 100644
--- a/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
+++ b/webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.cc
@@ -35,7 +35,7 @@ int AudioDecoderG722::DecodeInternal(const uint8_t* encoded,
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) {
- RTC_DCHECK_EQ(sample_rate_hz, 16000);
+ RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
int16_t temp_type = 1; // Default is speech.
size_t ret =
WebRtcG722_Decode(dec_state_, encoded, encoded_len, decoded, &temp_type);
@@ -53,6 +53,10 @@ int AudioDecoderG722::PacketDuration(const uint8_t* encoded,
return static_cast<int>(2 * encoded_len / Channels());
}
+int AudioDecoderG722::SampleRateHz() const {
+ return 16000;
+}
+
size_t AudioDecoderG722::Channels() const {
return 1;
}
@@ -74,7 +78,7 @@ int AudioDecoderG722Stereo::DecodeInternal(const uint8_t* encoded,
int sample_rate_hz,
int16_t* decoded,
SpeechType* speech_type) {
- RTC_DCHECK_EQ(sample_rate_hz, 16000);
+ RTC_DCHECK_EQ(SampleRateHz(), sample_rate_hz);
int16_t temp_type = 1; // Default is speech.
// De-interleave the bit-stream into two separate payloads.
uint8_t* encoded_deinterleaved = new uint8_t[encoded_len];
@@ -100,6 +104,10 @@ int AudioDecoderG722Stereo::DecodeInternal(const uint8_t* encoded,
return static_cast<int>(ret);
}
+int AudioDecoderG722Stereo::SampleRateHz() const {
+ return 16000;
+}
+
size_t AudioDecoderG722Stereo::Channels() const {
return 2;
}

Powered by Google App Engine
This is Rietveld 408576698