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

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

Issue 2950453002: Opus implementation of the AudioDecoderFactoryTemplate API (Closed)
Patch Set: rebase Created 3 years, 5 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/g722/audio_decoder_g722.h" 12 #include "webrtc/api/audio_codecs/g722/audio_decoder_g722.h"
13 #include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h" 13 #include "webrtc/api/audio_codecs/ilbc/audio_decoder_ilbc.h"
14 #include "webrtc/api/audio_codecs/opus/audio_decoder_opus.h"
14 #include "webrtc/base/ptr_util.h" 15 #include "webrtc/base/ptr_util.h"
15 #include "webrtc/test/gmock.h" 16 #include "webrtc/test/gmock.h"
16 #include "webrtc/test/gtest.h" 17 #include "webrtc/test/gtest.h"
17 #include "webrtc/test/mock_audio_decoder.h" 18 #include "webrtc/test/mock_audio_decoder.h"
18 19
19 namespace webrtc { 20 namespace webrtc {
20 21
21 namespace { 22 namespace {
22 23
23 struct BogusParams { 24 struct BogusParams {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 testing::ElementsAre( 139 testing::ElementsAre(
139 AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}})); 140 AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}}));
140 EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1})); 141 EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
141 EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1})); 142 EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1}));
142 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 8000, 1})); 143 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 8000, 1}));
143 auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1}); 144 auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1});
144 ASSERT_NE(nullptr, dec); 145 ASSERT_NE(nullptr, dec);
145 EXPECT_EQ(8000, dec->SampleRateHz()); 146 EXPECT_EQ(8000, dec->SampleRateHz());
146 } 147 }
147 148
149 TEST(AudioDecoderFactoryTemplateTest, Opus) {
150 auto factory = CreateAudioDecoderFactory<AudioDecoderOpus>();
151 AudioCodecInfo opus_info{48000, 1, 64000, 6000, 510000};
152 opus_info.allow_comfort_noise = false;
153 opus_info.supports_network_adaption = true;
154 const SdpAudioFormat opus_format(
155 {"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}});
156 EXPECT_THAT(factory->GetSupportedDecoders(),
157 testing::ElementsAre(AudioCodecSpec{opus_format, opus_info}));
158 EXPECT_FALSE(factory->IsSupportedDecoder({"opus", 48000, 1}));
159 EXPECT_TRUE(factory->IsSupportedDecoder({"opus", 48000, 2}));
160 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
161 auto dec = factory->MakeAudioDecoder({"opus", 48000, 2});
162 ASSERT_NE(nullptr, dec);
163 EXPECT_EQ(48000, dec->SampleRateHz());
164 }
165
148 } // namespace webrtc 166 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/audio_codecs/test/BUILD.gn ('k') | webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698