Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/base/ptr_util.h" | 14 #include "webrtc/base/ptr_util.h" |
| 14 #include "webrtc/test/gmock.h" | 15 #include "webrtc/test/gmock.h" |
| 15 #include "webrtc/test/gtest.h" | 16 #include "webrtc/test/gtest.h" |
| 16 #include "webrtc/test/mock_audio_decoder.h" | 17 #include "webrtc/test/mock_audio_decoder.h" |
| 17 | 18 |
| 18 namespace webrtc { | 19 namespace webrtc { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 struct BogusParams { | 23 struct BogusParams { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 EXPECT_EQ(16000, dec1->SampleRateHz()); | 125 EXPECT_EQ(16000, dec1->SampleRateHz()); |
| 125 EXPECT_EQ(1u, dec1->Channels()); | 126 EXPECT_EQ(1u, dec1->Channels()); |
| 126 auto dec2 = factory->MakeAudioDecoder({"g722", 8000, 2}); | 127 auto dec2 = factory->MakeAudioDecoder({"g722", 8000, 2}); |
| 127 ASSERT_NE(nullptr, dec2); | 128 ASSERT_NE(nullptr, dec2); |
| 128 EXPECT_EQ(16000, dec2->SampleRateHz()); | 129 EXPECT_EQ(16000, dec2->SampleRateHz()); |
| 129 EXPECT_EQ(2u, dec2->Channels()); | 130 EXPECT_EQ(2u, dec2->Channels()); |
| 130 auto dec3 = factory->MakeAudioDecoder({"g722", 8000, 3}); | 131 auto dec3 = factory->MakeAudioDecoder({"g722", 8000, 3}); |
| 131 ASSERT_EQ(nullptr, dec3); | 132 ASSERT_EQ(nullptr, dec3); |
| 132 } | 133 } |
| 133 | 134 |
| 135 TEST(AudioDecoderFactoryTemplateTest, Ilbc) { | |
| 136 auto factory = CreateAudioDecoderFactory<AudioDecoderIlbc>(); | |
| 137 EXPECT_THAT(factory->GetSupportedDecoders(), | |
| 138 testing::ElementsAre( | |
| 139 AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}})); | |
|
the sun
2017/06/27 12:07:19
What do you think about bitrate being 13300 here a
kwiberg-webrtc
2017/06/27 12:50:43
I hadn't caught that, actually.
For the decoder,
ossu
2017/06/27 12:53:14
Hmm... acm_codec_database.cc claims that it's 1330
| |
| 140 EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1})); | |
| 141 EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1})); | |
| 142 EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 8000, 1})); | |
| 143 auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1}); | |
| 144 ASSERT_NE(nullptr, dec); | |
| 145 EXPECT_EQ(8000, dec->SampleRateHz()); | |
| 146 } | |
| 147 | |
| 134 } // namespace webrtc | 148 } // namespace webrtc |
| OLD | NEW |