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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 8000, 1))); 99 EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 8000, 1)));
100 EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 8000, 2))); 100 EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 8000, 2)));
101 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 8000, 3))); 101 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 8000, 3)));
102 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 16000, 1))); 102 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 16000, 1)));
103 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 32000, 1))); 103 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("g722", 32000, 1)));
104 } 104 }
105 105
106 TEST(AudioDecoderFactoryTest, CreateOpus) { 106 TEST(AudioDecoderFactoryTest, CreateOpus) {
107 std::unique_ptr<AudioDecoderFactory> adf = CreateBuiltinAudioDecoderFactory(); 107 std::unique_ptr<AudioDecoderFactory> adf = CreateBuiltinAudioDecoderFactory();
108 ASSERT_TRUE(adf); 108 ASSERT_TRUE(adf);
109 // Opus supports 48 kHz, 1-2 channels. 109 // Opus supports 48 kHz, 2 channels, and wants a "stereo" parameter whose
110 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 0))); 110 // value is either "0" or "1".
111 EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 1))); 111 for (int hz : {8000, 16000, 32000, 48000}) {
112 EXPECT_TRUE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 2))); 112 for (int channels : {0, 1, 2, 3}) {
113 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 48000, 3))); 113 for (std::string stereo : {"XX", "0", "1", "2"}) {
114 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 8000, 1))); 114 std::map<std::string, std::string> params;
115 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 16000, 1))); 115 if (stereo != "XX") {
116 EXPECT_FALSE(adf->MakeAudioDecoder(SdpAudioFormat("opus", 32000, 1))); 116 params["stereo"] = stereo;
117 }
118 bool good =
119 (hz == 48000 && channels == 2 && (stereo == "0" || stereo == "1"));
120 EXPECT_EQ(good, static_cast<bool>(adf->MakeAudioDecoder(SdpAudioFormat(
121 "opus", hz, channels, std::move(params)))));
122 }
123 }
124 }
117 } 125 }
118 126
119 } // namespace webrtc 127 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698