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

Unified Diff: webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc

Issue 1928293002: NetEq: Use a BuiltinAudioDecoderFactory to create decoders (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rejigger Opus config Created 4 years, 8 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/audio_decoder_factory_unittest.cc
diff --git a/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc b/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc
index d278b8473ea6a74f084b95d52bb7ca98918b8f57..12a0a4047e87f0e656217d76de69b6934cb6364f 100644
--- a/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/audio_decoder_factory_unittest.cc
@@ -106,14 +106,22 @@ TEST(AudioDecoderFactoryTest, CreateG722) {
TEST(AudioDecoderFactoryTest, CreateOpus) {
std::unique_ptr<AudioDecoderFactory> adf = CreateBuiltinAudioDecoderFactory();
ASSERT_TRUE(adf);
- // Opus supports 48 kHz, 1-2 channels.
- EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 0)));
- EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 1)));
- EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 2)));
- EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 3)));
- EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 8000, 1)));
- EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 16000, 1)));
- EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 32000, 1)));
+ // Opus supports 48 kHz, 2 channels, and wants a "stereo" parameter whose
+ // value is either "0" or "1".
+ for (int hz : {8000, 16000, 32000, 48000}) {
+ for (int channels : {0, 1, 2, 3}) {
+ for (std::string stereo : {"XX", "0", "1", "2"}) {
+ std::map<std::string, std::string> params;
+ if (stereo != "XX") {
+ params["stereo"] = stereo;
+ }
+ bool good =
+ (hz == 48000 && channels == 2 && (stereo == "0" || stereo == "1"));
+ EXPECT_EQ(good, static_cast<bool>(adf->MakeAudioDecoder(SdpAudioFormat(
+ "opus", hz, channels, std::move(params)))));
+ }
+ }
+ }
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698