Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 #include "webrtc/rtc_base/arraysize.h" | 27 #include "webrtc/rtc_base/arraysize.h" |
| 28 #include "webrtc/rtc_base/byteorder.h" | 28 #include "webrtc/rtc_base/byteorder.h" |
| 29 #include "webrtc/rtc_base/safe_conversions.h" | 29 #include "webrtc/rtc_base/safe_conversions.h" |
| 30 #include "webrtc/rtc_base/scoped_ref_ptr.h" | 30 #include "webrtc/rtc_base/scoped_ref_ptr.h" |
| 31 #include "webrtc/test/field_trial.h" | 31 #include "webrtc/test/field_trial.h" |
| 32 #include "webrtc/test/gtest.h" | 32 #include "webrtc/test/gtest.h" |
| 33 #include "webrtc/test/mock_audio_decoder_factory.h" | 33 #include "webrtc/test/mock_audio_decoder_factory.h" |
| 34 #include "webrtc/test/mock_audio_encoder_factory.h" | 34 #include "webrtc/test/mock_audio_encoder_factory.h" |
| 35 #include "webrtc/voice_engine/transmit_mixer.h" | 35 #include "webrtc/voice_engine/transmit_mixer.h" |
| 36 | 36 |
| 37 using testing::_; | |
| 37 using testing::ContainerEq; | 38 using testing::ContainerEq; |
| 38 using testing::Return; | 39 using testing::Return; |
| 40 using testing::ReturnPointee; | |
| 41 using testing::SaveArg; | |
| 39 using testing::StrictMock; | 42 using testing::StrictMock; |
| 40 | 43 |
| 41 namespace { | 44 namespace { |
| 42 | 45 |
| 43 constexpr uint32_t kMaxUnsignaledRecvStreams = 4; | 46 constexpr uint32_t kMaxUnsignaledRecvStreams = 4; |
| 44 | 47 |
| 45 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1); | 48 const cricket::AudioCodec kPcmuCodec(0, "PCMU", 8000, 64000, 1); |
| 46 const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1); | 49 const cricket::AudioCodec kIsacCodec(103, "ISAC", 16000, 32000, 1); |
| 47 const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 32000, 2); | 50 const cricket::AudioCodec kOpusCodec(111, "opus", 48000, 32000, 2); |
| 48 const cricket::AudioCodec kG722CodecVoE(9, "G722", 16000, 64000, 1); | 51 const cricket::AudioCodec kG722CodecVoE(9, "G722", 16000, 64000, 1); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 } | 121 } |
| 119 } // namespace | 122 } // namespace |
| 120 | 123 |
| 121 // Tests that our stub library "works". | 124 // Tests that our stub library "works". |
| 122 TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) { | 125 TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) { |
| 123 StrictMock<webrtc::test::MockAudioDeviceModule> adm; | 126 StrictMock<webrtc::test::MockAudioDeviceModule> adm; |
| 124 AdmSetupExpectations(&adm); | 127 AdmSetupExpectations(&adm); |
| 125 rtc::scoped_refptr<StrictMock<webrtc::test::MockAudioProcessing>> apm = | 128 rtc::scoped_refptr<StrictMock<webrtc::test::MockAudioProcessing>> apm = |
| 126 new rtc::RefCountedObject< | 129 new rtc::RefCountedObject< |
| 127 StrictMock<webrtc::test::MockAudioProcessing>>(); | 130 StrictMock<webrtc::test::MockAudioProcessing>>(); |
| 128 EXPECT_CALL(*apm, ApplyConfig(testing::_)); | 131 webrtc::AudioProcessing::Config apm_config; |
| 132 EXPECT_CALL(*apm, GetConfig()).WillRepeatedly(ReturnPointee(&apm_config)); | |
| 133 EXPECT_CALL(*apm, ApplyConfig(_)).WillRepeatedly(SaveArg<0>(&apm_config)); | |
| 129 EXPECT_CALL(*apm, SetExtraOptions(testing::_)); | 134 EXPECT_CALL(*apm, SetExtraOptions(testing::_)); |
| 130 EXPECT_CALL(*apm, Initialize()).WillOnce(Return(0)); | 135 EXPECT_CALL(*apm, Initialize()).WillOnce(Return(0)); |
| 131 EXPECT_CALL(*apm, DetachAecDump()); | 136 EXPECT_CALL(*apm, DetachAecDump()); |
| 132 StrictMock<MockTransmitMixer> transmit_mixer; | 137 StrictMock<MockTransmitMixer> transmit_mixer; |
| 133 EXPECT_CALL(transmit_mixer, EnableStereoChannelSwapping(false)); | 138 EXPECT_CALL(transmit_mixer, EnableStereoChannelSwapping(false)); |
| 134 cricket::FakeWebRtcVoiceEngine voe(&transmit_mixer); | 139 cricket::FakeWebRtcVoiceEngine voe(&transmit_mixer); |
| 135 EXPECT_FALSE(voe.IsInited()); | 140 EXPECT_FALSE(voe.IsInited()); |
| 136 { | 141 { |
| 137 cricket::WebRtcVoiceEngine engine( | 142 cricket::WebRtcVoiceEngine engine( |
| 138 &adm, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), | 143 &adm, webrtc::MockAudioEncoderFactory::CreateUnusedFactory(), |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 163 apm_gc_(*apm_->gain_control()), | 168 apm_gc_(*apm_->gain_control()), |
| 164 apm_ec_(*apm_->echo_cancellation()), | 169 apm_ec_(*apm_->echo_cancellation()), |
| 165 apm_ns_(*apm_->noise_suppression()), | 170 apm_ns_(*apm_->noise_suppression()), |
| 166 apm_vd_(*apm_->voice_detection()), | 171 apm_vd_(*apm_->voice_detection()), |
| 167 call_(webrtc::Call::Config(&event_log_)), | 172 call_(webrtc::Call::Config(&event_log_)), |
| 168 voe_(&transmit_mixer_), | 173 voe_(&transmit_mixer_), |
| 169 override_field_trials_(field_trials) { | 174 override_field_trials_(field_trials) { |
| 170 // AudioDeviceModule. | 175 // AudioDeviceModule. |
| 171 AdmSetupExpectations(&adm_); | 176 AdmSetupExpectations(&adm_); |
| 172 // AudioProcessing. | 177 // AudioProcessing. |
| 173 EXPECT_CALL(*apm_, ApplyConfig(testing::_)); | 178 EXPECT_CALL(*apm_, GetConfig()).WillRepeatedly(ReturnPointee(&apm_config_)); |
| 179 EXPECT_CALL(*apm_, ApplyConfig(_)).WillRepeatedly(SaveArg<0>(&apm_config_)); | |
| 174 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); | 180 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); |
| 175 EXPECT_CALL(*apm_, Initialize()).WillOnce(Return(0)); | 181 EXPECT_CALL(*apm_, Initialize()).WillOnce(Return(0)); |
| 176 EXPECT_CALL(*apm_, DetachAecDump()); | 182 EXPECT_CALL(*apm_, DetachAecDump()); |
| 177 // Default Options. | 183 // Default Options. |
| 178 EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0)); | 184 EXPECT_CALL(apm_ec_, Enable(true)).WillOnce(Return(0)); |
| 179 EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0)); | 185 EXPECT_CALL(apm_ec_, enable_metrics(true)).WillOnce(Return(0)); |
| 180 EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0)); | 186 EXPECT_CALL(apm_gc_, Enable(true)).WillOnce(Return(0)); |
| 181 EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0)); | 187 EXPECT_CALL(apm_ns_, Enable(true)).WillOnce(Return(0)); |
| 182 EXPECT_CALL(apm_vd_, Enable(true)).WillOnce(Return(0)); | 188 EXPECT_CALL(apm_vd_, Enable(true)).WillOnce(Return(0)); |
| 183 EXPECT_CALL(transmit_mixer_, EnableStereoChannelSwapping(false)); | 189 EXPECT_CALL(transmit_mixer_, EnableStereoChannelSwapping(false)); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 197 decoder_factory, nullptr, apm_, | 203 decoder_factory, nullptr, apm_, |
| 198 new FakeVoEWrapper(&voe_))); | 204 new FakeVoEWrapper(&voe_))); |
| 199 engine_->Init(); | 205 engine_->Init(); |
| 200 send_parameters_.codecs.push_back(kPcmuCodec); | 206 send_parameters_.codecs.push_back(kPcmuCodec); |
| 201 recv_parameters_.codecs.push_back(kPcmuCodec); | 207 recv_parameters_.codecs.push_back(kPcmuCodec); |
| 202 // Default Options. | 208 // Default Options. |
| 203 EXPECT_TRUE(IsHighPassFilterEnabled()); | 209 EXPECT_TRUE(IsHighPassFilterEnabled()); |
| 204 } | 210 } |
| 205 | 211 |
| 206 bool SetupChannel() { | 212 bool SetupChannel() { |
| 207 EXPECT_CALL(*apm_, ApplyConfig(testing::_)); | |
|
peah-webrtc
2017/07/25 21:40:21
This EXPECT_CALL is actually redundant (and thereb
| |
| 208 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); | 213 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); |
| 209 channel_ = engine_->CreateChannel(&call_, cricket::MediaConfig(), | 214 channel_ = engine_->CreateChannel(&call_, cricket::MediaConfig(), |
| 210 cricket::AudioOptions()); | 215 cricket::AudioOptions()); |
| 211 return (channel_ != nullptr); | 216 return (channel_ != nullptr); |
| 212 } | 217 } |
| 213 | 218 |
| 214 bool SetupRecvStream() { | 219 bool SetupRecvStream() { |
| 215 if (!SetupChannel()) { | 220 if (!SetupChannel()) { |
| 216 return false; | 221 return false; |
| 217 } | 222 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) { | 276 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) { |
| 272 return GetRecvStream(ssrc).GetConfig(); | 277 return GetRecvStream(ssrc).GetConfig(); |
| 273 } | 278 } |
| 274 | 279 |
| 275 void SetSend(bool enable) { | 280 void SetSend(bool enable) { |
| 276 ASSERT_TRUE(channel_); | 281 ASSERT_TRUE(channel_); |
| 277 if (enable) { | 282 if (enable) { |
| 278 EXPECT_CALL(adm_, RecordingIsInitialized()).WillOnce(Return(false)); | 283 EXPECT_CALL(adm_, RecordingIsInitialized()).WillOnce(Return(false)); |
| 279 EXPECT_CALL(adm_, Recording()).WillOnce(Return(false)); | 284 EXPECT_CALL(adm_, Recording()).WillOnce(Return(false)); |
| 280 EXPECT_CALL(adm_, InitRecording()).WillOnce(Return(0)); | 285 EXPECT_CALL(adm_, InitRecording()).WillOnce(Return(0)); |
| 281 EXPECT_CALL(*apm_, ApplyConfig(testing::_)); | |
|
peah-webrtc
2017/07/25 21:40:21
Same comment as above regarding redundant code.
| |
| 282 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); | 286 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); |
| 283 } | 287 } |
| 284 channel_->SetSend(enable); | 288 channel_->SetSend(enable); |
| 285 } | 289 } |
| 286 | 290 |
| 287 void SetSendParameters(const cricket::AudioSendParameters& params) { | 291 void SetSendParameters(const cricket::AudioSendParameters& params) { |
| 288 EXPECT_CALL(*apm_, ApplyConfig(testing::_)); | |
|
peah-webrtc
2017/07/25 21:40:21
Same comment as above regarding redundant code.
| |
| 289 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); | 292 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); |
| 290 ASSERT_TRUE(channel_); | 293 ASSERT_TRUE(channel_); |
| 291 EXPECT_TRUE(channel_->SetSendParameters(params)); | 294 EXPECT_TRUE(channel_->SetSendParameters(params)); |
| 292 } | 295 } |
| 293 | 296 |
| 294 void SetAudioSend(uint32_t ssrc, bool enable, cricket::AudioSource* source, | 297 void SetAudioSend(uint32_t ssrc, bool enable, cricket::AudioSource* source, |
| 295 const cricket::AudioOptions* options = nullptr) { | 298 const cricket::AudioOptions* options = nullptr) { |
| 296 EXPECT_CALL(*apm_, set_output_will_be_muted(!enable)); | 299 EXPECT_CALL(*apm_, set_output_will_be_muted(!enable)); |
| 297 ASSERT_TRUE(channel_); | 300 ASSERT_TRUE(channel_); |
| 298 if (enable && options) { | 301 if (enable && options) { |
| 299 EXPECT_CALL(*apm_, ApplyConfig(testing::_)); | |
|
peah-webrtc
2017/07/25 21:40:21
Same comment as above regarding redundant code.
| |
| 300 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); | 302 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)); |
| 301 } | 303 } |
| 302 EXPECT_TRUE(channel_->SetAudioSend(ssrc, enable, options, source)); | 304 EXPECT_TRUE(channel_->SetAudioSend(ssrc, enable, options, source)); |
| 303 } | 305 } |
| 304 | 306 |
| 305 void TestInsertDtmf(uint32_t ssrc, bool caller, | 307 void TestInsertDtmf(uint32_t ssrc, bool caller, |
| 306 const cricket::AudioCodec& codec) { | 308 const cricket::AudioCodec& codec) { |
| 307 EXPECT_TRUE(SetupChannel()); | 309 EXPECT_TRUE(SetupChannel()); |
| 308 if (caller) { | 310 if (caller) { |
| 309 // If this is a caller, local description will be applied and add the | 311 // If this is a caller, local description will be applied and add the |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 } | 656 } |
| 655 EXPECT_EQ(recv_parameters_.codecs.size(), info.receive_codecs.size()); | 657 EXPECT_EQ(recv_parameters_.codecs.size(), info.receive_codecs.size()); |
| 656 for (const cricket::AudioCodec& codec : recv_parameters_.codecs) { | 658 for (const cricket::AudioCodec& codec : recv_parameters_.codecs) { |
| 657 ASSERT_EQ(info.receive_codecs.count(codec.id), 1U); | 659 ASSERT_EQ(info.receive_codecs.count(codec.id), 1U); |
| 658 EXPECT_EQ(info.receive_codecs.find(codec.id)->second, | 660 EXPECT_EQ(info.receive_codecs.find(codec.id)->second, |
| 659 codec.ToCodecParameters()); | 661 codec.ToCodecParameters()); |
| 660 } | 662 } |
| 661 } | 663 } |
| 662 | 664 |
| 663 bool IsHighPassFilterEnabled() { | 665 bool IsHighPassFilterEnabled() { |
| 664 return engine_->GetApmConfigForTest().high_pass_filter.enabled; | 666 return engine_->GetApmConfigForTest().high_pass_filter.enabled; |
|
Taylor Brandstetter
2017/07/25 22:24:00
nit: Can this now just use "apm_config_" directly,
peah-webrtc
2017/07/25 22:38:29
That sounds great!
I'll do it in another CL though
| |
| 665 } | 667 } |
| 666 | 668 |
| 667 protected: | 669 protected: |
| 668 StrictMock<webrtc::test::MockAudioDeviceModule> adm_; | 670 StrictMock<webrtc::test::MockAudioDeviceModule> adm_; |
| 669 rtc::scoped_refptr<StrictMock<webrtc::test::MockAudioProcessing>> apm_; | 671 rtc::scoped_refptr<StrictMock<webrtc::test::MockAudioProcessing>> apm_; |
| 670 webrtc::test::MockGainControl& apm_gc_; | 672 webrtc::test::MockGainControl& apm_gc_; |
| 671 webrtc::test::MockEchoCancellation& apm_ec_; | 673 webrtc::test::MockEchoCancellation& apm_ec_; |
| 672 webrtc::test::MockNoiseSuppression& apm_ns_; | 674 webrtc::test::MockNoiseSuppression& apm_ns_; |
| 673 webrtc::test::MockVoiceDetection& apm_vd_; | 675 webrtc::test::MockVoiceDetection& apm_vd_; |
| 674 StrictMock<MockTransmitMixer> transmit_mixer_; | 676 StrictMock<MockTransmitMixer> transmit_mixer_; |
| 675 webrtc::RtcEventLogNullImpl event_log_; | 677 webrtc::RtcEventLogNullImpl event_log_; |
| 676 cricket::FakeCall call_; | 678 cricket::FakeCall call_; |
| 677 cricket::FakeWebRtcVoiceEngine voe_; | 679 cricket::FakeWebRtcVoiceEngine voe_; |
| 678 std::unique_ptr<cricket::WebRtcVoiceEngine> engine_; | 680 std::unique_ptr<cricket::WebRtcVoiceEngine> engine_; |
| 679 cricket::VoiceMediaChannel* channel_ = nullptr; | 681 cricket::VoiceMediaChannel* channel_ = nullptr; |
| 680 cricket::AudioSendParameters send_parameters_; | 682 cricket::AudioSendParameters send_parameters_; |
| 681 cricket::AudioRecvParameters recv_parameters_; | 683 cricket::AudioRecvParameters recv_parameters_; |
| 682 FakeAudioSource fake_source_; | 684 FakeAudioSource fake_source_; |
| 685 webrtc::AudioProcessing::Config apm_config_; | |
| 686 | |
| 683 private: | 687 private: |
| 684 webrtc::test::ScopedFieldTrials override_field_trials_; | 688 webrtc::test::ScopedFieldTrials override_field_trials_; |
| 685 }; | 689 }; |
| 686 | 690 |
| 687 // Tests that we can create and destroy a channel. | 691 // Tests that we can create and destroy a channel. |
| 688 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) { | 692 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) { |
| 689 EXPECT_TRUE(SetupChannel()); | 693 EXPECT_TRUE(SetupChannel()); |
| 690 } | 694 } |
| 691 | 695 |
| 692 // Test that we can add a send stream and that it has the correct defaults. | 696 // Test that we can add a send stream and that it has the correct defaults. |
| (...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2795 EXPECT_CALL(adm_, | 2799 EXPECT_CALL(adm_, |
| 2796 BuiltInAECIsAvailable()).Times(8).WillRepeatedly(Return(false)); | 2800 BuiltInAECIsAvailable()).Times(8).WillRepeatedly(Return(false)); |
| 2797 EXPECT_CALL(adm_, | 2801 EXPECT_CALL(adm_, |
| 2798 BuiltInAGCIsAvailable()).Times(8).WillRepeatedly(Return(false)); | 2802 BuiltInAGCIsAvailable()).Times(8).WillRepeatedly(Return(false)); |
| 2799 EXPECT_CALL(adm_, | 2803 EXPECT_CALL(adm_, |
| 2800 BuiltInNSIsAvailable()).Times(8).WillRepeatedly(Return(false)); | 2804 BuiltInNSIsAvailable()).Times(8).WillRepeatedly(Return(false)); |
| 2801 EXPECT_CALL(adm_, | 2805 EXPECT_CALL(adm_, |
| 2802 RecordingIsInitialized()).Times(2).WillRepeatedly(Return(false)); | 2806 RecordingIsInitialized()).Times(2).WillRepeatedly(Return(false)); |
| 2803 EXPECT_CALL(adm_, Recording()).Times(2).WillRepeatedly(Return(false)); | 2807 EXPECT_CALL(adm_, Recording()).Times(2).WillRepeatedly(Return(false)); |
| 2804 EXPECT_CALL(adm_, InitRecording()).Times(2).WillRepeatedly(Return(0)); | 2808 EXPECT_CALL(adm_, InitRecording()).Times(2).WillRepeatedly(Return(0)); |
| 2805 EXPECT_CALL(*apm_, ApplyConfig(testing::_)).Times(10); | 2809 webrtc::AudioProcessing::Config apm_config; |
| 2810 EXPECT_CALL(*apm_, GetConfig()) | |
| 2811 .Times(10) | |
|
Taylor Brandstetter
2017/07/25 22:23:59
nit: I think this should be a "WillRepeatedly"; if
peah-webrtc
2017/07/25 22:38:29
I partly (or mostly) agree. I think that a main pa
| |
| 2812 .WillRepeatedly(ReturnPointee(&apm_config)); | |
| 2813 EXPECT_CALL(*apm_, ApplyConfig(_)) | |
| 2814 .Times(10) | |
| 2815 .WillRepeatedly(SaveArg<0>(&apm_config)); | |
| 2806 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)).Times(10); | 2816 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)).Times(10); |
| 2807 | 2817 |
| 2808 std::unique_ptr<cricket::WebRtcVoiceMediaChannel> channel1( | 2818 std::unique_ptr<cricket::WebRtcVoiceMediaChannel> channel1( |
| 2809 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_->CreateChannel( | 2819 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_->CreateChannel( |
| 2810 &call_, cricket::MediaConfig(), cricket::AudioOptions()))); | 2820 &call_, cricket::MediaConfig(), cricket::AudioOptions()))); |
| 2811 std::unique_ptr<cricket::WebRtcVoiceMediaChannel> channel2( | 2821 std::unique_ptr<cricket::WebRtcVoiceMediaChannel> channel2( |
| 2812 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_->CreateChannel( | 2822 static_cast<cricket::WebRtcVoiceMediaChannel*>(engine_->CreateChannel( |
| 2813 &call_, cricket::MediaConfig(), cricket::AudioOptions()))); | 2823 &call_, cricket::MediaConfig(), cricket::AudioOptions()))); |
| 2814 | 2824 |
| 2815 // Have to add a stream to make SetSend work. | 2825 // Have to add a stream to make SetSend work. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2906 EXPECT_EQ(expected_options, channel2->options()); | 2916 EXPECT_EQ(expected_options, channel2->options()); |
| 2907 } | 2917 } |
| 2908 | 2918 |
| 2909 // This test verifies DSCP settings are properly applied on voice media channel. | 2919 // This test verifies DSCP settings are properly applied on voice media channel. |
| 2910 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { | 2920 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { |
| 2911 EXPECT_TRUE(SetupSendStream()); | 2921 EXPECT_TRUE(SetupSendStream()); |
| 2912 cricket::FakeNetworkInterface network_interface; | 2922 cricket::FakeNetworkInterface network_interface; |
| 2913 cricket::MediaConfig config; | 2923 cricket::MediaConfig config; |
| 2914 std::unique_ptr<cricket::VoiceMediaChannel> channel; | 2924 std::unique_ptr<cricket::VoiceMediaChannel> channel; |
| 2915 | 2925 |
| 2916 EXPECT_CALL(*apm_, ApplyConfig(testing::_)).Times(3); | 2926 webrtc::AudioProcessing::Config apm_config; |
| 2927 EXPECT_CALL(*apm_, GetConfig()) | |
| 2928 .Times(3) | |
|
Taylor Brandstetter
2017/07/25 22:23:59
Same comment here.
peah-webrtc
2017/07/25 22:38:29
I agree, but as described above I'll keep it as it
| |
| 2929 .WillRepeatedly(ReturnPointee(&apm_config)); | |
| 2930 EXPECT_CALL(*apm_, ApplyConfig(_)) | |
| 2931 .Times(3) | |
| 2932 .WillRepeatedly(SaveArg<0>(&apm_config)); | |
| 2917 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)).Times(3); | 2933 EXPECT_CALL(*apm_, SetExtraOptions(testing::_)).Times(3); |
| 2918 | 2934 |
| 2919 channel.reset( | 2935 channel.reset( |
| 2920 engine_->CreateChannel(&call_, config, cricket::AudioOptions())); | 2936 engine_->CreateChannel(&call_, config, cricket::AudioOptions())); |
| 2921 channel->SetInterface(&network_interface); | 2937 channel->SetInterface(&network_interface); |
| 2922 // Default value when DSCP is disabled should be DSCP_DEFAULT. | 2938 // Default value when DSCP is disabled should be DSCP_DEFAULT. |
| 2923 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp()); | 2939 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface.dscp()); |
| 2924 | 2940 |
| 2925 config.enable_dscp = true; | 2941 config.enable_dscp = true; |
| 2926 channel.reset( | 2942 channel.reset( |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3482 // Without this cast, the comparison turned unsigned and, thus, failed for -1. | 3498 // Without this cast, the comparison turned unsigned and, thus, failed for -1. |
| 3483 const int num_specs = static_cast<int>(specs.size()); | 3499 const int num_specs = static_cast<int>(specs.size()); |
| 3484 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); | 3500 EXPECT_GE(find_codec({"cn", 8000, 1}), num_specs); |
| 3485 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); | 3501 EXPECT_GE(find_codec({"cn", 16000, 1}), num_specs); |
| 3486 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); | 3502 EXPECT_EQ(find_codec({"cn", 32000, 1}), -1); |
| 3487 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); | 3503 EXPECT_GE(find_codec({"telephone-event", 8000, 1}), num_specs); |
| 3488 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); | 3504 EXPECT_GE(find_codec({"telephone-event", 16000, 1}), num_specs); |
| 3489 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); | 3505 EXPECT_GE(find_codec({"telephone-event", 32000, 1}), num_specs); |
| 3490 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); | 3506 EXPECT_GE(find_codec({"telephone-event", 48000, 1}), num_specs); |
| 3491 } | 3507 } |
| OLD | NEW |