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

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

Issue 2996693002: iSAC fixed-point implementation of the Audio{En,De}coderFactoryTemplate APIs (Closed)
Patch Set: review comments 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
11 #include "webrtc/api/audio_codecs/audio_decoder_factory_template.h" 11 #include "webrtc/api/audio_codecs/audio_decoder_factory_template.h"
12 #include "webrtc/api/audio_codecs/L16/audio_decoder_L16.h" 12 #include "webrtc/api/audio_codecs/L16/audio_decoder_L16.h"
13 #include "webrtc/api/audio_codecs/g711/audio_decoder_g711.h" 13 #include "webrtc/api/audio_codecs/g711/audio_decoder_g711.h"
14 #include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h" 14 #include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h"
15 #include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h" 15 #include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h"
16 #include "webrtc/api/audio_codecs/isac/audio_decoder_isac_fix.h"
16 #include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h" 17 #include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h"
17 #include "webrtc/rtc_base/ptr_util.h" 18 #include "webrtc/rtc_base/ptr_util.h"
18 #include "webrtc/test/gmock.h" 19 #include "webrtc/test/gmock.h"
19 #include "webrtc/test/gtest.h" 20 #include "webrtc/test/gtest.h"
20 #include "webrtc/test/mock_audio_decoder.h" 21 #include "webrtc/test/mock_audio_decoder.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 namespace { 25 namespace {
25 26
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 testing::ElementsAre( 160 testing::ElementsAre(
160 AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}})); 161 AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}}));
161 EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1})); 162 EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
162 EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1})); 163 EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1}));
163 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 8000, 1})); 164 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 8000, 1}));
164 auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1}); 165 auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1});
165 ASSERT_NE(nullptr, dec); 166 ASSERT_NE(nullptr, dec);
166 EXPECT_EQ(8000, dec->SampleRateHz()); 167 EXPECT_EQ(8000, dec->SampleRateHz());
167 } 168 }
168 169
170 TEST(AudioDecoderFactoryTemplateTest, IsacFix) {
171 auto factory = CreateAudioDecoderFactory<AudioDecoderIsacFix>();
172 EXPECT_THAT(factory->GetSupportedDecoders(),
173 testing::ElementsAre(AudioCodecSpec{
174 {"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}}));
175 EXPECT_FALSE(factory->IsSupportedDecoder({"isac", 16000, 2}));
176 EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 16000, 1}));
177 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"isac", 8000, 1}));
178 auto dec = factory->MakeAudioDecoder({"isac", 16000, 1});
179 ASSERT_NE(nullptr, dec);
180 EXPECT_EQ(16000, dec->SampleRateHz());
181 }
182
169 TEST(AudioDecoderFactoryTemplateTest, L16) { 183 TEST(AudioDecoderFactoryTemplateTest, L16) {
170 auto factory = CreateAudioDecoderFactory<AudioDecoderL16>(); 184 auto factory = CreateAudioDecoderFactory<AudioDecoderL16>();
171 EXPECT_THAT( 185 EXPECT_THAT(
172 factory->GetSupportedDecoders(), 186 factory->GetSupportedDecoders(),
173 testing::ElementsAre( 187 testing::ElementsAre(
174 AudioCodecSpec{{"L16", 8000, 1}, {8000, 1, 8000 * 16}}, 188 AudioCodecSpec{{"L16", 8000, 1}, {8000, 1, 8000 * 16}},
175 AudioCodecSpec{{"L16", 16000, 1}, {16000, 1, 16000 * 16}}, 189 AudioCodecSpec{{"L16", 16000, 1}, {16000, 1, 16000 * 16}},
176 AudioCodecSpec{{"L16", 32000, 1}, {32000, 1, 32000 * 16}}, 190 AudioCodecSpec{{"L16", 32000, 1}, {32000, 1, 32000 * 16}},
177 AudioCodecSpec{{"L16", 8000, 2}, {8000, 2, 8000 * 16 * 2}}, 191 AudioCodecSpec{{"L16", 8000, 2}, {8000, 2, 8000 * 16 * 2}},
178 AudioCodecSpec{{"L16", 16000, 2}, {16000, 2, 16000 * 16 * 2}}, 192 AudioCodecSpec{{"L16", 16000, 2}, {16000, 2, 16000 * 16 * 2}},
(...skipping 18 matching lines...) Expand all
197 testing::ElementsAre(AudioCodecSpec{opus_format, opus_info})); 211 testing::ElementsAre(AudioCodecSpec{opus_format, opus_info}));
198 EXPECT_FALSE(factory->IsSupportedDecoder({"opus", 48000, 1})); 212 EXPECT_FALSE(factory->IsSupportedDecoder({"opus", 48000, 1}));
199 EXPECT_TRUE(factory->IsSupportedDecoder({"opus", 48000, 2})); 213 EXPECT_TRUE(factory->IsSupportedDecoder({"opus", 48000, 2}));
200 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1})); 214 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
201 auto dec = factory->MakeAudioDecoder({"opus", 48000, 2}); 215 auto dec = factory->MakeAudioDecoder({"opus", 48000, 2});
202 ASSERT_NE(nullptr, dec); 216 ASSERT_NE(nullptr, dec);
203 EXPECT_EQ(48000, dec->SampleRateHz()); 217 EXPECT_EQ(48000, dec->SampleRateHz());
204 } 218 }
205 219
206 } // namespace webrtc 220 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698