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

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

Issue 2940833002: G722 implementation of the AudioDecoderFactoryTemplate API (Closed)
Patch Set: Created 3 years, 6 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/base/ptr_util.h" 13 #include "webrtc/base/ptr_util.h"
13 #include "webrtc/test/gmock.h" 14 #include "webrtc/test/gmock.h"
14 #include "webrtc/test/gtest.h" 15 #include "webrtc/test/gtest.h"
15 #include "webrtc/test/mock_audio_decoder.h" 16 #include "webrtc/test/mock_audio_decoder.h"
16 17
17 namespace webrtc { 18 namespace webrtc {
18 19
19 namespace { 20 namespace {
20 21
21 struct BogusParams { 22 struct BogusParams {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 auto dec1 = factory->MakeAudioDecoder({"bogus", 8000, 1}); 104 auto dec1 = factory->MakeAudioDecoder({"bogus", 8000, 1});
104 ASSERT_NE(nullptr, dec1); 105 ASSERT_NE(nullptr, dec1);
105 EXPECT_EQ(8000, dec1->SampleRateHz()); 106 EXPECT_EQ(8000, dec1->SampleRateHz());
106 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"sham", 16000, 2})); 107 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"sham", 16000, 2}));
107 auto dec2 = 108 auto dec2 =
108 factory->MakeAudioDecoder({"sham", 16000, 2, {{"param", "value"}}}); 109 factory->MakeAudioDecoder({"sham", 16000, 2, {{"param", "value"}}});
109 ASSERT_NE(nullptr, dec2); 110 ASSERT_NE(nullptr, dec2);
110 EXPECT_EQ(16000, dec2->SampleRateHz()); 111 EXPECT_EQ(16000, dec2->SampleRateHz());
111 } 112 }
112 113
114 TEST(AudioDecoderFactoryTemplateTest, G722) {
115 auto factory = CreateAudioDecoderFactory<AudioDecoderG722>();
116 EXPECT_THAT(factory->GetSupportedDecoders(),
117 testing::ElementsAre(
118 AudioCodecSpec{{"g722", 8000, 1}, {16000, 1, 64000}}));
119 EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
120 EXPECT_TRUE(factory->IsSupportedDecoder({"g722", 8000, 1}));
121 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 16000, 1}));
122 auto dec = factory->MakeAudioDecoder({"g722", 8000, 1});
123 ASSERT_NE(nullptr, dec);
124 EXPECT_EQ(16000, dec->SampleRateHz());
125 }
126
113 } // namespace webrtc 127 } // 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