| OLD | NEW |
| 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 3763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3774 webrtc::Call::Create(webrtc::Call::Config(&event_log))); | 3774 webrtc::Call::Create(webrtc::Call::Config(&event_log))); |
| 3775 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3775 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
| 3776 cricket::AudioOptions(), call.get()); | 3776 cricket::AudioOptions(), call.get()); |
| 3777 cricket::AudioRecvParameters parameters; | 3777 cricket::AudioRecvParameters parameters; |
| 3778 parameters.codecs = engine.recv_codecs(); | 3778 parameters.codecs = engine.recv_codecs(); |
| 3779 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3779 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
| 3780 } | 3780 } |
| 3781 | 3781 |
| 3782 TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) { | 3782 TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) { |
| 3783 std::vector<webrtc::AudioCodecSpec> specs; | 3783 std::vector<webrtc::AudioCodecSpec> specs; |
| 3784 webrtc::AudioCodecSpec spec1({"codec1", 48000, 2, {{"param1", "value1"}}}); | 3784 webrtc::AudioCodecSpec spec1{{"codec1", 48000, 2, {{"param1", "value1"}}}, |
| 3785 spec1.allow_comfort_noise = false; | 3785 {48000, 2, 16000, 10000, 20000}}; |
| 3786 spec1.supports_network_adaption = true; | 3786 spec1.info.allow_comfort_noise = false; |
| 3787 spec1.info.supports_network_adaption = true; |
| 3787 specs.push_back(spec1); | 3788 specs.push_back(spec1); |
| 3788 webrtc::AudioCodecSpec spec2({"codec2", 32000, 1}); | 3789 webrtc::AudioCodecSpec spec2{{"codec2", 32000, 1}, {32000, 1, 32000}}; |
| 3789 spec2.allow_comfort_noise = false; | 3790 spec2.info.allow_comfort_noise = false; |
| 3790 specs.push_back(spec2); | 3791 specs.push_back(spec2); |
| 3791 specs.push_back(webrtc::AudioCodecSpec({"codec3", 16000, 1, | 3792 specs.push_back(webrtc::AudioCodecSpec{ |
| 3792 {{"param1", "value1b"}, | 3793 {"codec3", 16000, 1, {{"param1", "value1b"}, {"param2", "value2"}}}, |
| 3793 {"param2", "value2"}}})); | 3794 {16000, 1, 13300}}); |
| 3794 specs.push_back(webrtc::AudioCodecSpec({"codec4", 8000, 1})); | 3795 specs.push_back( |
| 3795 specs.push_back(webrtc::AudioCodecSpec({"codec5", 8000, 2})); | 3796 webrtc::AudioCodecSpec{{"codec4", 8000, 1}, {8000, 1, 64000}}); |
| 3797 specs.push_back( |
| 3798 webrtc::AudioCodecSpec{{"codec5", 8000, 2}, {8000, 1, 64000}}); |
| 3796 | 3799 |
| 3797 rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> mock_factory = | 3800 rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> mock_factory = |
| 3798 new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>; | 3801 new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>; |
| 3799 EXPECT_CALL(*mock_factory.get(), GetSupportedDecoders()) | 3802 EXPECT_CALL(*mock_factory.get(), GetSupportedDecoders()) |
| 3800 .WillOnce(Return(specs)); | 3803 .WillOnce(Return(specs)); |
| 3801 | 3804 |
| 3802 cricket::WebRtcVoiceEngine engine(nullptr, mock_factory, nullptr); | 3805 cricket::WebRtcVoiceEngine engine(nullptr, mock_factory, nullptr); |
| 3803 auto codecs = engine.recv_codecs(); | 3806 auto codecs = engine.recv_codecs(); |
| 3804 EXPECT_EQ(11, codecs.size()); | 3807 EXPECT_EQ(11, codecs.size()); |
| 3805 | 3808 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3841 // Without this cast, the comparison turned unsigned and, thus, failed for -1. | 3844 // Without this cast, the comparison turned unsigned and, thus, failed for -1. |
| 3842 const int num_specs = static_cast<int>(specs.size()); | 3845 const int num_specs = static_cast<int>(specs.size()); |
| 3843 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); | 3846 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); |
| 3844 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); | 3847 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); |
| 3845 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); | 3848 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); |
| 3846 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); | 3849 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); |
| 3847 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); | 3850 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); |
| 3848 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); | 3851 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); |
| 3849 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); | 3852 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); |
| 3850 } | 3853 } |
| OLD | NEW |