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

Unified Diff: webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.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/builtin_audio_decoder_factory.cc
diff --git a/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.cc b/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.cc
index deb1b1f4bd5dbda45c45d9386fc91f7382733c2b..48b2f5d437312de30531837bda4c34fb9ca04732 100644
--- a/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.cc
+++ b/webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.cc
@@ -74,7 +74,7 @@ NamedDecoderConstructor decoder_constructors[] = {
{"isac",
[](const SdpAudioFormat& format) {
return format.clockrate_hz == 16000 && format.num_channels == 1
- ? Unique(new AudioDecoderIsacFix)
+ ? Unique(new AudioDecoderIsacFix(format.clockrate_hz))
: nullptr;
}},
#elif defined(WEBRTC_CODEC_ISAC)
@@ -82,14 +82,15 @@ NamedDecoderConstructor decoder_constructors[] = {
[](const SdpAudioFormat& format) {
return (format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
format.num_channels == 1
- ? Unique(new AudioDecoderIsac)
+ ? Unique(new AudioDecoderIsac(format.clockrate_hz))
: nullptr;
}},
#endif
{"l16",
[](const SdpAudioFormat& format) {
return format.num_channels >= 1
- ? Unique(new AudioDecoderPcm16B(format.num_channels))
+ ? Unique(new AudioDecoderPcm16B(format.clockrate_hz,
+ format.num_channels))
: nullptr;
}},
#ifdef WEBRTC_CODEC_G722
@@ -136,7 +137,15 @@ class BuiltinAudioDecoderFactory : public AudioDecoderFactory {
const SdpAudioFormat& format) override {
for (const auto& dc : decoder_constructors) {
if (STR_CASE_CMP(format.name.c_str(), dc.name) == 0) {
- return std::unique_ptr<AudioDecoder>(dc.constructor(format));
+ std::unique_ptr<AudioDecoder> dec = dc.constructor(format);
+ if (dec) {
+ const int expected_sample_rate_hz =
+ STR_CASE_CMP(format.name.c_str(), "g722") == 0
+ ? 2 * format.clockrate_hz
+ : format.clockrate_hz;
+ RTC_CHECK_EQ(expected_sample_rate_hz, dec->SampleRateHz());
+ }
+ return dec;
}
}
return nullptr;
« no previous file with comments | « webrtc/modules/audio_coding/codecs/audio_decoder.cc ('k') | webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698