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

Side by Side Diff: webrtc/api/audio_codecs/test/audio_encoder_factory_template_unittest.cc

Issue 2998263002: Reimplement the builtin audio codec factories using the new stuff in api/ (Closed)
Patch Set: use upper-case Created 3 years, 4 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) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 EXPECT_EQ(8000, enc1->SampleRateHz()); 140 EXPECT_EQ(8000, enc1->SampleRateHz());
141 auto enc2 = factory->MakeAudioEncoder(17, {"PCMA", 8000, 1}); 141 auto enc2 = factory->MakeAudioEncoder(17, {"PCMA", 8000, 1});
142 ASSERT_NE(nullptr, enc2); 142 ASSERT_NE(nullptr, enc2);
143 EXPECT_EQ(8000, enc2->SampleRateHz()); 143 EXPECT_EQ(8000, enc2->SampleRateHz());
144 } 144 }
145 145
146 TEST(AudioEncoderFactoryTemplateTest, G722) { 146 TEST(AudioEncoderFactoryTemplateTest, G722) {
147 auto factory = CreateAudioEncoderFactory<AudioEncoderG722>(); 147 auto factory = CreateAudioEncoderFactory<AudioEncoderG722>();
148 EXPECT_THAT(factory->GetSupportedEncoders(), 148 EXPECT_THAT(factory->GetSupportedEncoders(),
149 testing::ElementsAre( 149 testing::ElementsAre(
150 AudioCodecSpec{{"g722", 8000, 1}, {16000, 1, 64000}})); 150 AudioCodecSpec{{"G722", 8000, 1}, {16000, 1, 64000}}));
151 EXPECT_EQ(rtc::Optional<AudioCodecInfo>(), 151 EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
152 factory->QueryAudioEncoder({"foo", 8000, 1})); 152 factory->QueryAudioEncoder({"foo", 8000, 1}));
153 EXPECT_EQ(rtc::Optional<AudioCodecInfo>({16000, 1, 64000}), 153 EXPECT_EQ(rtc::Optional<AudioCodecInfo>({16000, 1, 64000}),
154 factory->QueryAudioEncoder({"g722", 8000, 1})); 154 factory->QueryAudioEncoder({"G722", 8000, 1}));
155 EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1})); 155 EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
156 auto enc = factory->MakeAudioEncoder(17, {"g722", 8000, 1}); 156 auto enc = factory->MakeAudioEncoder(17, {"G722", 8000, 1});
157 ASSERT_NE(nullptr, enc); 157 ASSERT_NE(nullptr, enc);
158 EXPECT_EQ(16000, enc->SampleRateHz()); 158 EXPECT_EQ(16000, enc->SampleRateHz());
159 } 159 }
160 160
161 TEST(AudioEncoderFactoryTemplateTest, Ilbc) { 161 TEST(AudioEncoderFactoryTemplateTest, Ilbc) {
162 auto factory = CreateAudioEncoderFactory<AudioEncoderIlbc>(); 162 auto factory = CreateAudioEncoderFactory<AudioEncoderIlbc>();
163 EXPECT_THAT(factory->GetSupportedEncoders(), 163 EXPECT_THAT(factory->GetSupportedEncoders(),
164 testing::ElementsAre( 164 testing::ElementsAre(
165 AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13333}})); 165 AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13333}}));
166 EXPECT_EQ(rtc::Optional<AudioCodecInfo>(), 166 EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 rtc::Optional<AudioCodecInfo>(info), 254 rtc::Optional<AudioCodecInfo>(info),
255 factory->QueryAudioEncoder( 255 factory->QueryAudioEncoder(
256 {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}})); 256 {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}));
257 EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1})); 257 EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
258 auto enc = factory->MakeAudioEncoder(17, {"opus", 48000, 2}); 258 auto enc = factory->MakeAudioEncoder(17, {"opus", 48000, 2});
259 ASSERT_NE(nullptr, enc); 259 ASSERT_NE(nullptr, enc);
260 EXPECT_EQ(48000, enc->SampleRateHz()); 260 EXPECT_EQ(48000, enc->SampleRateHz());
261 } 261 }
262 262
263 } // namespace webrtc 263 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/audio_codecs/test/audio_decoder_factory_template_unittest.cc ('k') | webrtc/modules/audio_coding/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698