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

Unified Diff: webrtc/api/audio_codecs/g722/audio_decoder_g722.cc

Issue 2945423003: Don't forget to support G722 stereo decoding (Closed)
Patch Set: Created 3 years, 6 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/api/audio_codecs/g722/audio_decoder_g722.cc
diff --git a/webrtc/api/audio_codecs/g722/audio_decoder_g722.cc b/webrtc/api/audio_codecs/g722/audio_decoder_g722.cc
index e4cb1b7d69340c28a4ec1ff8ace39c842dd4e744..346a7f2779c36345b3087f81e0741898f0d85275 100644
--- a/webrtc/api/audio_codecs/g722/audio_decoder_g722.cc
+++ b/webrtc/api/audio_codecs/g722/audio_decoder_g722.cc
@@ -23,8 +23,10 @@ namespace webrtc {
rtc::Optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
const SdpAudioFormat& format) {
return STR_CASE_CMP(format.name.c_str(), "g722") == 0 &&
- format.clockrate_hz == 8000
- ? rtc::Optional<Config>(Config())
+ format.clockrate_hz == 8000 &&
+ (format.num_channels == 1 || format.num_channels == 2)
+ ? rtc::Optional<Config>(
+ Config{rtc::dchecked_cast<int>(format.num_channels)})
: rtc::Optional<Config>();
}
@@ -35,7 +37,14 @@ void AudioDecoderG722::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder(
Config config) {
- return rtc::MakeUnique<AudioDecoderG722Impl>();
+ switch (config.num_channels) {
+ case 1:
+ return rtc::MakeUnique<AudioDecoderG722Impl>();
+ case 2:
+ return rtc::MakeUnique<AudioDecoderG722StereoImpl>();
+ default:
+ return nullptr;
+ }
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698