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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 2695243005: Injectable audio encoders: BuiltinAudioEncoderFactory (Closed)
Patch Set: Cleaned up parameter parsing in AudioCodecOpus Created 3 years, 9 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) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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
(...skipping 3731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3742 webrtc::Call::Create(webrtc::Call::Config(&event_log))); 3742 webrtc::Call::Create(webrtc::Call::Config(&event_log)));
3743 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3743 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3744 cricket::AudioOptions(), call.get()); 3744 cricket::AudioOptions(), call.get());
3745 cricket::AudioRecvParameters parameters; 3745 cricket::AudioRecvParameters parameters;
3746 parameters.codecs = engine.recv_codecs(); 3746 parameters.codecs = engine.recv_codecs();
3747 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3747 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3748 } 3748 }
3749 3749
3750 TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) { 3750 TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
3751 std::vector<webrtc::AudioCodecSpec> specs; 3751 std::vector<webrtc::AudioCodecSpec> specs;
3752 webrtc::AudioCodecSpec spec1({"codec1", 48000, 2, {{"param1", "value1"}}}); 3752 webrtc::AudioCodecSpec spec1{{"codec1", 48000, 2, {{"param1", "value1"}}},
3753 spec1.allow_comfort_noise = false; 3753 {48000, 2, 16000, 10000, 20000}};
3754 spec1.supports_network_adaption = true; 3754 spec1.info.allow_comfort_noise = false;
3755 spec1.info.supports_network_adaption = true;
3755 specs.push_back(spec1); 3756 specs.push_back(spec1);
3756 webrtc::AudioCodecSpec spec2({"codec2", 32000, 1}); 3757 webrtc::AudioCodecSpec spec2{{"codec2", 32000, 1},
3757 spec2.allow_comfort_noise = false; 3758 {32000, 1, 32000}};
3759 spec2.info.allow_comfort_noise = false;
3758 specs.push_back(spec2); 3760 specs.push_back(spec2);
3759 specs.push_back(webrtc::AudioCodecSpec({"codec3", 16000, 1, 3761 specs.push_back(webrtc::AudioCodecSpec{
3760 {{"param1", "value1b"}, 3762 {"codec3", 16000, 1,
3761 {"param2", "value2"}}})); 3763 {{"param1", "value1b"},
3762 specs.push_back(webrtc::AudioCodecSpec({"codec4", 8000, 1})); 3764 {"param2", "value2"}}},
3763 specs.push_back(webrtc::AudioCodecSpec({"codec5", 8000, 2})); 3765 {16000, 1, 13300}});
3766 specs.push_back(
3767 webrtc::AudioCodecSpec{{"codec4", 8000, 1}, {8000, 1, 64000}});
3768 specs.push_back(
3769 webrtc::AudioCodecSpec{{"codec5", 8000, 2}, {8000, 1, 64000}});
3764 3770
3765 rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> mock_factory = 3771 rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> mock_factory =
3766 new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>; 3772 new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
3767 EXPECT_CALL(*mock_factory.get(), GetSupportedDecoders()) 3773 EXPECT_CALL(*mock_factory.get(), GetSupportedDecoders())
3768 .WillOnce(Return(specs)); 3774 .WillOnce(Return(specs));
3769 3775
3770 cricket::WebRtcVoiceEngine engine(nullptr, mock_factory, nullptr); 3776 cricket::WebRtcVoiceEngine engine(nullptr, mock_factory, nullptr);
3771 auto codecs = engine.recv_codecs(); 3777 auto codecs = engine.recv_codecs();
3772 EXPECT_EQ(11, codecs.size()); 3778 EXPECT_EQ(11, codecs.size());
3773 3779
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3809 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3815 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3810 const int num_specs = static_cast<int>(specs.size()); 3816 const int num_specs = static_cast<int>(specs.size());
3811 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3817 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3812 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3818 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3813 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3819 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3814 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3820 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3815 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3821 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3816 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3822 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3817 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3823 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3818 } 3824 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698