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

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

Issue 2934833002: G722 implementation of the AudioEncoderFactoryTemplate API (Closed)
Patch Set: rebase 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
« no previous file with comments | « webrtc/api/audio_codecs/test/BUILD.gn ('k') | webrtc/modules/audio_coding/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_encoder_factory_template.h" 11 #include "webrtc/api/audio_codecs/audio_encoder_factory_template.h"
12 #include "webrtc/api/audio_codecs/g722/audio_encoder_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_encoder.h" 16 #include "webrtc/test/mock_audio_encoder.h"
16 17
17 namespace webrtc { 18 namespace webrtc {
18 19
19 namespace { 20 namespace {
20 21
21 struct BogusParams { 22 struct BogusParams {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 auto enc1 = factory->MakeAudioEncoder(17, {"bogus", 8000, 1}); 111 auto enc1 = factory->MakeAudioEncoder(17, {"bogus", 8000, 1});
111 ASSERT_NE(nullptr, enc1); 112 ASSERT_NE(nullptr, enc1);
112 EXPECT_EQ(8000, enc1->SampleRateHz()); 113 EXPECT_EQ(8000, enc1->SampleRateHz());
113 EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"sham", 16000, 2})); 114 EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"sham", 16000, 2}));
114 auto enc2 = 115 auto enc2 =
115 factory->MakeAudioEncoder(17, {"sham", 16000, 2, {{"param", "value"}}}); 116 factory->MakeAudioEncoder(17, {"sham", 16000, 2, {{"param", "value"}}});
116 ASSERT_NE(nullptr, enc2); 117 ASSERT_NE(nullptr, enc2);
117 EXPECT_EQ(16000, enc2->SampleRateHz()); 118 EXPECT_EQ(16000, enc2->SampleRateHz());
118 } 119 }
119 120
121 TEST(AudioEncoderFactoryTemplateTest, G722) {
122 auto factory = CreateAudioEncoderFactory<AudioEncoderG722>();
123 EXPECT_THAT(factory->GetSupportedEncoders(),
124 testing::ElementsAre(
125 AudioCodecSpec{{"g722", 8000, 1}, {16000, 1, 64000}}));
126 EXPECT_EQ(rtc::Optional<AudioCodecInfo>(),
127 factory->QueryAudioEncoder({"foo", 8000, 1}));
128 EXPECT_EQ(rtc::Optional<AudioCodecInfo>({16000, 1, 64000}),
129 factory->QueryAudioEncoder({"g722", 8000, 1}));
130 EXPECT_EQ(nullptr, factory->MakeAudioEncoder(17, {"bar", 16000, 1}));
131 auto enc = factory->MakeAudioEncoder(17, {"g722", 8000, 1});
132 ASSERT_NE(nullptr, enc);
133 EXPECT_EQ(16000, enc->SampleRateHz());
134 }
135
120 } // namespace webrtc 136 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/audio_codecs/test/BUILD.gn ('k') | webrtc/modules/audio_coding/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698