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

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

Issue 2695243005: Injectable audio encoders: BuiltinAudioEncoderFactory (Closed)
Patch Set: Removed stub versions of AudioEncoderFactory from peerconnectioninterface.h Created 3 years, 10 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 3677 matching lines...) Expand 10 before | Expand all | Expand 10 after
3688 webrtc::Call::Create(webrtc::Call::Config(&event_log))); 3688 webrtc::Call::Create(webrtc::Call::Config(&event_log)));
3689 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3689 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3690 cricket::AudioOptions(), call.get()); 3690 cricket::AudioOptions(), call.get());
3691 cricket::AudioRecvParameters parameters; 3691 cricket::AudioRecvParameters parameters;
3692 parameters.codecs = engine.recv_codecs(); 3692 parameters.codecs = engine.recv_codecs();
3693 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3693 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3694 } 3694 }
3695 3695
3696 TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) { 3696 TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
3697 std::vector<webrtc::AudioCodecSpec> specs; 3697 std::vector<webrtc::AudioCodecSpec> specs;
3698 webrtc::AudioCodecSpec spec1({"codec1", 48000, 2, {{"param1", "value1"}}}); 3698 webrtc::AudioCodecSpec spec1{{"codec1", 48000, 2, {{"param1", "value1"}}},
3699 spec1.allow_comfort_noise = false; 3699 {48000, 2, 16000, 10000, 20000}};
3700 spec1.supports_network_adaption = true; 3700 spec1.info.allow_comfort_noise = false;
3701 spec1.info.supports_network_adaption = true;
3701 specs.push_back(spec1); 3702 specs.push_back(spec1);
3702 webrtc::AudioCodecSpec spec2({"codec2", 32000, 1}); 3703 webrtc::AudioCodecSpec spec2{{"codec2", 32000, 1},
3703 spec2.allow_comfort_noise = false; 3704 {32000, 1, 32000}};
3705 spec2.info.allow_comfort_noise = false;
3704 specs.push_back(spec2); 3706 specs.push_back(spec2);
3705 specs.push_back(webrtc::AudioCodecSpec({"codec3", 16000, 1, 3707 specs.push_back(webrtc::AudioCodecSpec{
3706 {{"param1", "value1b"}, 3708 {"codec3", 16000, 1,
3707 {"param2", "value2"}}})); 3709 {{"param1", "value1b"},
3708 specs.push_back(webrtc::AudioCodecSpec({"codec4", 8000, 1})); 3710 {"param2", "value2"}}},
3709 specs.push_back(webrtc::AudioCodecSpec({"codec5", 8000, 2})); 3711 {16000, 1, 13300}});
3712 specs.push_back(
3713 webrtc::AudioCodecSpec{{"codec4", 8000, 1}, {8000, 1, 64000}});
3714 specs.push_back(
3715 webrtc::AudioCodecSpec{{"codec5", 8000, 2}, {8000, 1, 64000}});
3710 3716
3711 rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> mock_factory = 3717 rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> mock_factory =
3712 new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>; 3718 new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
3713 EXPECT_CALL(*mock_factory.get(), GetSupportedDecoders()) 3719 EXPECT_CALL(*mock_factory.get(), GetSupportedDecoders())
3714 .WillOnce(Return(specs)); 3720 .WillOnce(Return(specs));
3715 3721
3716 cricket::WebRtcVoiceEngine engine(nullptr, mock_factory, nullptr); 3722 cricket::WebRtcVoiceEngine engine(nullptr, mock_factory, nullptr);
3717 auto codecs = engine.recv_codecs(); 3723 auto codecs = engine.recv_codecs();
3718 EXPECT_EQ(11, codecs.size()); 3724 EXPECT_EQ(11, codecs.size());
3719 3725
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 // Without this cast, the comparison turned unsigned and, thus, failed for -1. 3761 // Without this cast, the comparison turned unsigned and, thus, failed for -1.
3756 const int num_specs = static_cast<int>(specs.size()); 3762 const int num_specs = static_cast<int>(specs.size());
3757 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); 3763 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs);
3758 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); 3764 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs);
3759 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); 3765 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1);
3760 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); 3766 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs);
3761 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); 3767 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs);
3762 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); 3768 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs);
3763 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); 3769 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs);
3764 } 3770 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698