OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 class WebRtcVoiceEngineTestFake : public testing::Test { | 90 class WebRtcVoiceEngineTestFake : public testing::Test { |
91 public: | 91 public: |
92 WebRtcVoiceEngineTestFake() | 92 WebRtcVoiceEngineTestFake() |
93 : call_(webrtc::Call::Config()), | 93 : call_(webrtc::Call::Config()), |
94 voe_(kAudioCodecs, ARRAY_SIZE(kAudioCodecs)), | 94 voe_(kAudioCodecs, ARRAY_SIZE(kAudioCodecs)), |
95 trace_wrapper_(new FakeVoETraceWrapper()), | 95 trace_wrapper_(new FakeVoETraceWrapper()), |
96 engine_(new FakeVoEWrapper(&voe_), trace_wrapper_), | 96 engine_(new FakeVoEWrapper(&voe_), trace_wrapper_), |
97 channel_(nullptr) { | 97 channel_(nullptr) { |
98 send_parameters_.codecs.push_back(kPcmuCodec); | 98 send_parameters_.codecs.push_back(kPcmuCodec); |
99 recv_parameters_.codecs.push_back(kPcmuCodec); | 99 recv_parameters_.codecs.push_back(kPcmuCodec); |
100 options_adjust_agc_.adjust_agc_delta = rtc::Maybe<int>(-10); | 100 options_adjust_agc_.adjust_agc_delta = rtc::Optional<int>(-10); |
101 } | 101 } |
102 bool SetupEngine() { | 102 bool SetupEngine() { |
103 if (!engine_.Init(rtc::Thread::Current())) { | 103 if (!engine_.Init(rtc::Thread::Current())) { |
104 return false; | 104 return false; |
105 } | 105 } |
106 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); | 106 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); |
107 return (channel_ != nullptr); | 107 return (channel_ != nullptr); |
108 } | 108 } |
109 bool SetupEngineWithRecvStream() { | 109 bool SetupEngineWithRecvStream() { |
110 if (!SetupEngine()) { | 110 if (!SetupEngine()) { |
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2275 EXPECT_EQ(0, agc_config.targetLeveldBOv); // level was restored | 2275 EXPECT_EQ(0, agc_config.targetLeveldBOv); // level was restored |
2276 } | 2276 } |
2277 | 2277 |
2278 TEST_F(WebRtcVoiceEngineTestFake, TxAgcConfigViaOptions) { | 2278 TEST_F(WebRtcVoiceEngineTestFake, TxAgcConfigViaOptions) { |
2279 EXPECT_TRUE(SetupEngineWithSendStream()); | 2279 EXPECT_TRUE(SetupEngineWithSendStream()); |
2280 webrtc::AgcConfig agc_config; | 2280 webrtc::AgcConfig agc_config; |
2281 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2281 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
2282 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2282 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
2283 | 2283 |
2284 cricket::AudioOptions options; | 2284 cricket::AudioOptions options; |
2285 options.tx_agc_target_dbov = rtc::Maybe<uint16_t>(3); | 2285 options.tx_agc_target_dbov = rtc::Optional<uint16_t>(3); |
2286 options.tx_agc_digital_compression_gain = rtc::Maybe<uint16_t>(9); | 2286 options.tx_agc_digital_compression_gain = rtc::Optional<uint16_t>(9); |
2287 options.tx_agc_limiter = rtc::Maybe<bool>(true); | 2287 options.tx_agc_limiter = rtc::Optional<bool>(true); |
2288 options.auto_gain_control = rtc::Maybe<bool>(true); | 2288 options.auto_gain_control = rtc::Optional<bool>(true); |
2289 EXPECT_TRUE(engine_.SetOptions(options)); | 2289 EXPECT_TRUE(engine_.SetOptions(options)); |
2290 | 2290 |
2291 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2291 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
2292 EXPECT_EQ(3, agc_config.targetLeveldBOv); | 2292 EXPECT_EQ(3, agc_config.targetLeveldBOv); |
2293 EXPECT_EQ(9, agc_config.digitalCompressionGaindB); | 2293 EXPECT_EQ(9, agc_config.digitalCompressionGaindB); |
2294 EXPECT_TRUE(agc_config.limiterEnable); | 2294 EXPECT_TRUE(agc_config.limiterEnable); |
2295 | 2295 |
2296 // Check interaction with adjust_agc_delta. Both should be respected, for | 2296 // Check interaction with adjust_agc_delta. Both should be respected, for |
2297 // backwards compatibility. | 2297 // backwards compatibility. |
2298 options.adjust_agc_delta = rtc::Maybe<int>(-10); | 2298 options.adjust_agc_delta = rtc::Optional<int>(-10); |
2299 EXPECT_TRUE(engine_.SetOptions(options)); | 2299 EXPECT_TRUE(engine_.SetOptions(options)); |
2300 | 2300 |
2301 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2301 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
2302 EXPECT_EQ(13, agc_config.targetLeveldBOv); | 2302 EXPECT_EQ(13, agc_config.targetLeveldBOv); |
2303 } | 2303 } |
2304 | 2304 |
2305 TEST_F(WebRtcVoiceEngineTestFake, SampleRatesViaOptions) { | 2305 TEST_F(WebRtcVoiceEngineTestFake, SampleRatesViaOptions) { |
2306 EXPECT_TRUE(SetupEngineWithSendStream()); | 2306 EXPECT_TRUE(SetupEngineWithSendStream()); |
2307 cricket::AudioOptions options; | 2307 cricket::AudioOptions options; |
2308 options.recording_sample_rate = rtc::Maybe<uint32_t>(48000); | 2308 options.recording_sample_rate = rtc::Optional<uint32_t>(48000); |
2309 options.playout_sample_rate = rtc::Maybe<uint32_t>(44100); | 2309 options.playout_sample_rate = rtc::Optional<uint32_t>(44100); |
2310 EXPECT_TRUE(engine_.SetOptions(options)); | 2310 EXPECT_TRUE(engine_.SetOptions(options)); |
2311 | 2311 |
2312 unsigned int recording_sample_rate, playout_sample_rate; | 2312 unsigned int recording_sample_rate, playout_sample_rate; |
2313 EXPECT_EQ(0, voe_.RecordingSampleRate(&recording_sample_rate)); | 2313 EXPECT_EQ(0, voe_.RecordingSampleRate(&recording_sample_rate)); |
2314 EXPECT_EQ(0, voe_.PlayoutSampleRate(&playout_sample_rate)); | 2314 EXPECT_EQ(0, voe_.PlayoutSampleRate(&playout_sample_rate)); |
2315 EXPECT_EQ(48000u, recording_sample_rate); | 2315 EXPECT_EQ(48000u, recording_sample_rate); |
2316 EXPECT_EQ(44100u, playout_sample_rate); | 2316 EXPECT_EQ(44100u, playout_sample_rate); |
2317 } | 2317 } |
2318 | 2318 |
2319 TEST_F(WebRtcVoiceEngineTestFake, TraceFilterViaTraceOptions) { | 2319 TEST_F(WebRtcVoiceEngineTestFake, TraceFilterViaTraceOptions) { |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2632 EXPECT_TRUE(highpass_filter_enabled); | 2632 EXPECT_TRUE(highpass_filter_enabled); |
2633 EXPECT_FALSE(stereo_swapping_enabled); | 2633 EXPECT_FALSE(stereo_swapping_enabled); |
2634 EXPECT_TRUE(typing_detection_enabled); | 2634 EXPECT_TRUE(typing_detection_enabled); |
2635 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2635 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
2636 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); | 2636 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); |
2637 EXPECT_EQ(50, voe_.GetNetEqCapacity()); // From GetDefaultEngineOptions(). | 2637 EXPECT_EQ(50, voe_.GetNetEqCapacity()); // From GetDefaultEngineOptions(). |
2638 EXPECT_FALSE( | 2638 EXPECT_FALSE( |
2639 voe_.GetNetEqFastAccelerate()); // From GetDefaultEngineOptions(). | 2639 voe_.GetNetEqFastAccelerate()); // From GetDefaultEngineOptions(). |
2640 | 2640 |
2641 // Turn echo cancellation off | 2641 // Turn echo cancellation off |
2642 options.echo_cancellation = rtc::Maybe<bool>(false); | 2642 options.echo_cancellation = rtc::Optional<bool>(false); |
2643 ASSERT_TRUE(engine_.SetOptions(options)); | 2643 ASSERT_TRUE(engine_.SetOptions(options)); |
2644 voe_.GetEcStatus(ec_enabled, ec_mode); | 2644 voe_.GetEcStatus(ec_enabled, ec_mode); |
2645 EXPECT_FALSE(ec_enabled); | 2645 EXPECT_FALSE(ec_enabled); |
2646 | 2646 |
2647 // Turn echo cancellation back on, with settings, and make sure | 2647 // Turn echo cancellation back on, with settings, and make sure |
2648 // nothing else changed. | 2648 // nothing else changed. |
2649 options.echo_cancellation = rtc::Maybe<bool>(true); | 2649 options.echo_cancellation = rtc::Optional<bool>(true); |
2650 ASSERT_TRUE(engine_.SetOptions(options)); | 2650 ASSERT_TRUE(engine_.SetOptions(options)); |
2651 voe_.GetEcStatus(ec_enabled, ec_mode); | 2651 voe_.GetEcStatus(ec_enabled, ec_mode); |
2652 voe_.GetAecmMode(aecm_mode, cng_enabled); | 2652 voe_.GetAecmMode(aecm_mode, cng_enabled); |
2653 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2653 voe_.GetAgcStatus(agc_enabled, agc_mode); |
2654 voe_.GetAgcConfig(agc_config); | 2654 voe_.GetAgcConfig(agc_config); |
2655 voe_.GetNsStatus(ns_enabled, ns_mode); | 2655 voe_.GetNsStatus(ns_enabled, ns_mode); |
2656 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); | 2656 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); |
2657 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); | 2657 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); |
2658 voe_.GetTypingDetectionStatus(typing_detection_enabled); | 2658 voe_.GetTypingDetectionStatus(typing_detection_enabled); |
2659 EXPECT_TRUE(ec_enabled); | 2659 EXPECT_TRUE(ec_enabled); |
2660 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2660 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
2661 EXPECT_TRUE(agc_enabled); | 2661 EXPECT_TRUE(agc_enabled); |
2662 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2662 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
2663 EXPECT_TRUE(ns_enabled); | 2663 EXPECT_TRUE(ns_enabled); |
2664 EXPECT_TRUE(highpass_filter_enabled); | 2664 EXPECT_TRUE(highpass_filter_enabled); |
2665 EXPECT_FALSE(stereo_swapping_enabled); | 2665 EXPECT_FALSE(stereo_swapping_enabled); |
2666 EXPECT_TRUE(typing_detection_enabled); | 2666 EXPECT_TRUE(typing_detection_enabled); |
2667 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2667 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
2668 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); | 2668 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); |
2669 | 2669 |
2670 // Turn on delay agnostic aec and make sure nothing change w.r.t. echo | 2670 // Turn on delay agnostic aec and make sure nothing change w.r.t. echo |
2671 // control. | 2671 // control. |
2672 options.delay_agnostic_aec = rtc::Maybe<bool>(true); | 2672 options.delay_agnostic_aec = rtc::Optional<bool>(true); |
2673 ASSERT_TRUE(engine_.SetOptions(options)); | 2673 ASSERT_TRUE(engine_.SetOptions(options)); |
2674 voe_.GetEcStatus(ec_enabled, ec_mode); | 2674 voe_.GetEcStatus(ec_enabled, ec_mode); |
2675 voe_.GetAecmMode(aecm_mode, cng_enabled); | 2675 voe_.GetAecmMode(aecm_mode, cng_enabled); |
2676 EXPECT_TRUE(ec_enabled); | 2676 EXPECT_TRUE(ec_enabled); |
2677 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2677 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
2678 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2678 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
2679 | 2679 |
2680 // Turn off echo cancellation and delay agnostic aec. | 2680 // Turn off echo cancellation and delay agnostic aec. |
2681 options.delay_agnostic_aec = rtc::Maybe<bool>(false); | 2681 options.delay_agnostic_aec = rtc::Optional<bool>(false); |
2682 options.extended_filter_aec = rtc::Maybe<bool>(false); | 2682 options.extended_filter_aec = rtc::Optional<bool>(false); |
2683 options.echo_cancellation = rtc::Maybe<bool>(false); | 2683 options.echo_cancellation = rtc::Optional<bool>(false); |
2684 ASSERT_TRUE(engine_.SetOptions(options)); | 2684 ASSERT_TRUE(engine_.SetOptions(options)); |
2685 voe_.GetEcStatus(ec_enabled, ec_mode); | 2685 voe_.GetEcStatus(ec_enabled, ec_mode); |
2686 EXPECT_FALSE(ec_enabled); | 2686 EXPECT_FALSE(ec_enabled); |
2687 // Turning delay agnostic aec back on should also turn on echo cancellation. | 2687 // Turning delay agnostic aec back on should also turn on echo cancellation. |
2688 options.delay_agnostic_aec = rtc::Maybe<bool>(true); | 2688 options.delay_agnostic_aec = rtc::Optional<bool>(true); |
2689 ASSERT_TRUE(engine_.SetOptions(options)); | 2689 ASSERT_TRUE(engine_.SetOptions(options)); |
2690 voe_.GetEcStatus(ec_enabled, ec_mode); | 2690 voe_.GetEcStatus(ec_enabled, ec_mode); |
2691 EXPECT_TRUE(ec_enabled); | 2691 EXPECT_TRUE(ec_enabled); |
2692 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2692 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
2693 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2693 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
2694 | 2694 |
2695 // Turn off AGC | 2695 // Turn off AGC |
2696 options.auto_gain_control = rtc::Maybe<bool>(false); | 2696 options.auto_gain_control = rtc::Optional<bool>(false); |
2697 ASSERT_TRUE(engine_.SetOptions(options)); | 2697 ASSERT_TRUE(engine_.SetOptions(options)); |
2698 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2698 voe_.GetAgcStatus(agc_enabled, agc_mode); |
2699 EXPECT_FALSE(agc_enabled); | 2699 EXPECT_FALSE(agc_enabled); |
2700 | 2700 |
2701 // Turn AGC back on | 2701 // Turn AGC back on |
2702 options.auto_gain_control = rtc::Maybe<bool>(true); | 2702 options.auto_gain_control = rtc::Optional<bool>(true); |
2703 options.adjust_agc_delta = rtc::Maybe<int>(); | 2703 options.adjust_agc_delta = rtc::Optional<int>(); |
2704 ASSERT_TRUE(engine_.SetOptions(options)); | 2704 ASSERT_TRUE(engine_.SetOptions(options)); |
2705 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2705 voe_.GetAgcStatus(agc_enabled, agc_mode); |
2706 EXPECT_TRUE(agc_enabled); | 2706 EXPECT_TRUE(agc_enabled); |
2707 voe_.GetAgcConfig(agc_config); | 2707 voe_.GetAgcConfig(agc_config); |
2708 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2708 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
2709 | 2709 |
2710 // Turn off other options (and stereo swapping on). | 2710 // Turn off other options (and stereo swapping on). |
2711 options.noise_suppression = rtc::Maybe<bool>(false); | 2711 options.noise_suppression = rtc::Optional<bool>(false); |
2712 options.highpass_filter = rtc::Maybe<bool>(false); | 2712 options.highpass_filter = rtc::Optional<bool>(false); |
2713 options.typing_detection = rtc::Maybe<bool>(false); | 2713 options.typing_detection = rtc::Optional<bool>(false); |
2714 options.stereo_swapping = rtc::Maybe<bool>(true); | 2714 options.stereo_swapping = rtc::Optional<bool>(true); |
2715 ASSERT_TRUE(engine_.SetOptions(options)); | 2715 ASSERT_TRUE(engine_.SetOptions(options)); |
2716 voe_.GetNsStatus(ns_enabled, ns_mode); | 2716 voe_.GetNsStatus(ns_enabled, ns_mode); |
2717 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); | 2717 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); |
2718 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); | 2718 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); |
2719 voe_.GetTypingDetectionStatus(typing_detection_enabled); | 2719 voe_.GetTypingDetectionStatus(typing_detection_enabled); |
2720 EXPECT_FALSE(ns_enabled); | 2720 EXPECT_FALSE(ns_enabled); |
2721 EXPECT_FALSE(highpass_filter_enabled); | 2721 EXPECT_FALSE(highpass_filter_enabled); |
2722 EXPECT_FALSE(typing_detection_enabled); | 2722 EXPECT_FALSE(typing_detection_enabled); |
2723 EXPECT_TRUE(stereo_swapping_enabled); | 2723 EXPECT_TRUE(stereo_swapping_enabled); |
2724 | 2724 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 // Have to add a stream to make SetSend work. | 2787 // Have to add a stream to make SetSend work. |
2788 cricket::StreamParams stream1; | 2788 cricket::StreamParams stream1; |
2789 stream1.ssrcs.push_back(1); | 2789 stream1.ssrcs.push_back(1); |
2790 channel1->AddSendStream(stream1); | 2790 channel1->AddSendStream(stream1); |
2791 cricket::StreamParams stream2; | 2791 cricket::StreamParams stream2; |
2792 stream2.ssrcs.push_back(2); | 2792 stream2.ssrcs.push_back(2); |
2793 channel2->AddSendStream(stream2); | 2793 channel2->AddSendStream(stream2); |
2794 | 2794 |
2795 // AEC and AGC and NS | 2795 // AEC and AGC and NS |
2796 cricket::AudioSendParameters parameters_options_all = send_parameters_; | 2796 cricket::AudioSendParameters parameters_options_all = send_parameters_; |
2797 parameters_options_all.options.echo_cancellation = rtc::Maybe<bool>(true); | 2797 parameters_options_all.options.echo_cancellation = rtc::Optional<bool>(true); |
2798 parameters_options_all.options.auto_gain_control = rtc::Maybe<bool>(true); | 2798 parameters_options_all.options.auto_gain_control = rtc::Optional<bool>(true); |
2799 parameters_options_all.options.noise_suppression = rtc::Maybe<bool>(true); | 2799 parameters_options_all.options.noise_suppression = rtc::Optional<bool>(true); |
2800 ASSERT_TRUE(channel1->SetSendParameters(parameters_options_all)); | 2800 ASSERT_TRUE(channel1->SetSendParameters(parameters_options_all)); |
2801 EXPECT_EQ(parameters_options_all.options, channel1->options()); | 2801 EXPECT_EQ(parameters_options_all.options, channel1->options()); |
2802 ASSERT_TRUE(channel2->SetSendParameters(parameters_options_all)); | 2802 ASSERT_TRUE(channel2->SetSendParameters(parameters_options_all)); |
2803 EXPECT_EQ(parameters_options_all.options, channel2->options()); | 2803 EXPECT_EQ(parameters_options_all.options, channel2->options()); |
2804 | 2804 |
2805 // unset NS | 2805 // unset NS |
2806 cricket::AudioSendParameters parameters_options_no_ns = send_parameters_; | 2806 cricket::AudioSendParameters parameters_options_no_ns = send_parameters_; |
2807 parameters_options_no_ns.options.noise_suppression = rtc::Maybe<bool>(false); | 2807 parameters_options_no_ns.options.noise_suppression = |
| 2808 rtc::Optional<bool>(false); |
2808 ASSERT_TRUE(channel1->SetSendParameters(parameters_options_no_ns)); | 2809 ASSERT_TRUE(channel1->SetSendParameters(parameters_options_no_ns)); |
2809 cricket::AudioOptions expected_options = parameters_options_all.options; | 2810 cricket::AudioOptions expected_options = parameters_options_all.options; |
2810 expected_options.echo_cancellation = rtc::Maybe<bool>(true); | 2811 expected_options.echo_cancellation = rtc::Optional<bool>(true); |
2811 expected_options.auto_gain_control = rtc::Maybe<bool>(true); | 2812 expected_options.auto_gain_control = rtc::Optional<bool>(true); |
2812 expected_options.noise_suppression = rtc::Maybe<bool>(false); | 2813 expected_options.noise_suppression = rtc::Optional<bool>(false); |
2813 EXPECT_EQ(expected_options, channel1->options()); | 2814 EXPECT_EQ(expected_options, channel1->options()); |
2814 | 2815 |
2815 // unset AGC | 2816 // unset AGC |
2816 cricket::AudioSendParameters parameters_options_no_agc = send_parameters_; | 2817 cricket::AudioSendParameters parameters_options_no_agc = send_parameters_; |
2817 parameters_options_no_agc.options.auto_gain_control = rtc::Maybe<bool>(false); | 2818 parameters_options_no_agc.options.auto_gain_control = |
| 2819 rtc::Optional<bool>(false); |
2818 ASSERT_TRUE(channel2->SetSendParameters(parameters_options_no_agc)); | 2820 ASSERT_TRUE(channel2->SetSendParameters(parameters_options_no_agc)); |
2819 expected_options.echo_cancellation = rtc::Maybe<bool>(true); | 2821 expected_options.echo_cancellation = rtc::Optional<bool>(true); |
2820 expected_options.auto_gain_control = rtc::Maybe<bool>(false); | 2822 expected_options.auto_gain_control = rtc::Optional<bool>(false); |
2821 expected_options.noise_suppression = rtc::Maybe<bool>(true); | 2823 expected_options.noise_suppression = rtc::Optional<bool>(true); |
2822 EXPECT_EQ(expected_options, channel2->options()); | 2824 EXPECT_EQ(expected_options, channel2->options()); |
2823 | 2825 |
2824 ASSERT_TRUE(engine_.SetOptions(parameters_options_all.options)); | 2826 ASSERT_TRUE(engine_.SetOptions(parameters_options_all.options)); |
2825 bool ec_enabled; | 2827 bool ec_enabled; |
2826 webrtc::EcModes ec_mode; | 2828 webrtc::EcModes ec_mode; |
2827 bool agc_enabled; | 2829 bool agc_enabled; |
2828 webrtc::AgcModes agc_mode; | 2830 webrtc::AgcModes agc_mode; |
2829 bool ns_enabled; | 2831 bool ns_enabled; |
2830 webrtc::NsModes ns_mode; | 2832 webrtc::NsModes ns_mode; |
2831 voe_.GetEcStatus(ec_enabled, ec_mode); | 2833 voe_.GetEcStatus(ec_enabled, ec_mode); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2865 voe_.GetNsStatus(ns_enabled, ns_mode); | 2867 voe_.GetNsStatus(ns_enabled, ns_mode); |
2866 EXPECT_TRUE(ec_enabled); | 2868 EXPECT_TRUE(ec_enabled); |
2867 EXPECT_TRUE(agc_enabled); | 2869 EXPECT_TRUE(agc_enabled); |
2868 EXPECT_TRUE(ns_enabled); | 2870 EXPECT_TRUE(ns_enabled); |
2869 | 2871 |
2870 // Make sure settings take effect while we are sending. | 2872 // Make sure settings take effect while we are sending. |
2871 ASSERT_TRUE(engine_.SetOptions(parameters_options_all.options)); | 2873 ASSERT_TRUE(engine_.SetOptions(parameters_options_all.options)); |
2872 cricket::AudioSendParameters parameters_options_no_agc_nor_ns = | 2874 cricket::AudioSendParameters parameters_options_no_agc_nor_ns = |
2873 send_parameters_; | 2875 send_parameters_; |
2874 parameters_options_no_agc_nor_ns.options.auto_gain_control = | 2876 parameters_options_no_agc_nor_ns.options.auto_gain_control = |
2875 rtc::Maybe<bool>(false); | 2877 rtc::Optional<bool>(false); |
2876 parameters_options_no_agc_nor_ns.options.noise_suppression = | 2878 parameters_options_no_agc_nor_ns.options.noise_suppression = |
2877 rtc::Maybe<bool>(false); | 2879 rtc::Optional<bool>(false); |
2878 channel2->SetSend(cricket::SEND_MICROPHONE); | 2880 channel2->SetSend(cricket::SEND_MICROPHONE); |
2879 channel2->SetSendParameters(parameters_options_no_agc_nor_ns); | 2881 channel2->SetSendParameters(parameters_options_no_agc_nor_ns); |
2880 expected_options.echo_cancellation = rtc::Maybe<bool>(true); | 2882 expected_options.echo_cancellation = rtc::Optional<bool>(true); |
2881 expected_options.auto_gain_control = rtc::Maybe<bool>(false); | 2883 expected_options.auto_gain_control = rtc::Optional<bool>(false); |
2882 expected_options.noise_suppression = rtc::Maybe<bool>(false); | 2884 expected_options.noise_suppression = rtc::Optional<bool>(false); |
2883 EXPECT_EQ(expected_options, channel2->options()); | 2885 EXPECT_EQ(expected_options, channel2->options()); |
2884 voe_.GetEcStatus(ec_enabled, ec_mode); | 2886 voe_.GetEcStatus(ec_enabled, ec_mode); |
2885 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2887 voe_.GetAgcStatus(agc_enabled, agc_mode); |
2886 voe_.GetNsStatus(ns_enabled, ns_mode); | 2888 voe_.GetNsStatus(ns_enabled, ns_mode); |
2887 EXPECT_TRUE(ec_enabled); | 2889 EXPECT_TRUE(ec_enabled); |
2888 EXPECT_FALSE(agc_enabled); | 2890 EXPECT_FALSE(agc_enabled); |
2889 EXPECT_FALSE(ns_enabled); | 2891 EXPECT_FALSE(ns_enabled); |
2890 } | 2892 } |
2891 | 2893 |
2892 // This test verifies DSCP settings are properly applied on voice media channel. | 2894 // This test verifies DSCP settings are properly applied on voice media channel. |
2893 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { | 2895 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { |
2894 EXPECT_TRUE(SetupEngineWithSendStream()); | 2896 EXPECT_TRUE(SetupEngineWithSendStream()); |
2895 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel( | 2897 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel( |
2896 engine_.CreateChannel(&call_, cricket::AudioOptions())); | 2898 engine_.CreateChannel(&call_, cricket::AudioOptions())); |
2897 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( | 2899 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( |
2898 new cricket::FakeNetworkInterface); | 2900 new cricket::FakeNetworkInterface); |
2899 channel->SetInterface(network_interface.get()); | 2901 channel->SetInterface(network_interface.get()); |
2900 cricket::AudioSendParameters parameters = send_parameters_; | 2902 cricket::AudioSendParameters parameters = send_parameters_; |
2901 parameters.options.dscp = rtc::Maybe<bool>(true); | 2903 parameters.options.dscp = rtc::Optional<bool>(true); |
2902 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 2904 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
2903 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp()); | 2905 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp()); |
2904 // Verify previous value is not modified if dscp option is not set. | 2906 // Verify previous value is not modified if dscp option is not set. |
2905 EXPECT_TRUE(channel->SetSendParameters(send_parameters_)); | 2907 EXPECT_TRUE(channel->SetSendParameters(send_parameters_)); |
2906 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp()); | 2908 EXPECT_EQ(rtc::DSCP_EF, network_interface->dscp()); |
2907 parameters.options.dscp = rtc::Maybe<bool>(false); | 2909 parameters.options.dscp = rtc::Optional<bool>(false); |
2908 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 2910 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
2909 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); | 2911 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); |
2910 } | 2912 } |
2911 | 2913 |
2912 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) { | 2914 TEST_F(WebRtcVoiceEngineTestFake, TestGetReceiveChannelId) { |
2913 EXPECT_TRUE(SetupEngine()); | 2915 EXPECT_TRUE(SetupEngine()); |
2914 cricket::WebRtcVoiceMediaChannel* media_channel = | 2916 cricket::WebRtcVoiceMediaChannel* media_channel = |
2915 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 2917 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
2916 EXPECT_EQ(-1, media_channel->GetReceiveChannelId(0)); | 2918 EXPECT_EQ(-1, media_channel->GetReceiveChannelId(0)); |
2917 EXPECT_TRUE(channel_->AddRecvStream( | 2919 EXPECT_TRUE(channel_->AddRecvStream( |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3006 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); | 3008 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); |
3007 | 3009 |
3008 // Combined BWE should be disabled. | 3010 // Combined BWE should be disabled. |
3009 for (uint32_t ssrc : ssrcs) { | 3011 for (uint32_t ssrc : ssrcs) { |
3010 const auto* s = call_.GetAudioReceiveStream(ssrc); | 3012 const auto* s = call_.GetAudioReceiveStream(ssrc); |
3011 EXPECT_NE(nullptr, s); | 3013 EXPECT_NE(nullptr, s); |
3012 EXPECT_FALSE(s->GetConfig().combined_audio_video_bwe); | 3014 EXPECT_FALSE(s->GetConfig().combined_audio_video_bwe); |
3013 } | 3015 } |
3014 | 3016 |
3015 // Enable combined BWE option - now it should be set up. | 3017 // Enable combined BWE option - now it should be set up. |
3016 send_parameters_.options.combined_audio_video_bwe = rtc::Maybe<bool>(true); | 3018 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true); |
3017 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); | 3019 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); |
3018 for (uint32_t ssrc : ssrcs) { | 3020 for (uint32_t ssrc : ssrcs) { |
3019 const auto* s = call_.GetAudioReceiveStream(ssrc); | 3021 const auto* s = call_.GetAudioReceiveStream(ssrc); |
3020 EXPECT_NE(nullptr, s); | 3022 EXPECT_NE(nullptr, s); |
3021 EXPECT_EQ(true, s->GetConfig().combined_audio_video_bwe); | 3023 EXPECT_EQ(true, s->GetConfig().combined_audio_video_bwe); |
3022 } | 3024 } |
3023 | 3025 |
3024 // Disable combined BWE option - should be disabled again. | 3026 // Disable combined BWE option - should be disabled again. |
3025 send_parameters_.options.combined_audio_video_bwe = rtc::Maybe<bool>(false); | 3027 send_parameters_.options.combined_audio_video_bwe = |
| 3028 rtc::Optional<bool>(false); |
3026 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); | 3029 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); |
3027 for (uint32_t ssrc : ssrcs) { | 3030 for (uint32_t ssrc : ssrcs) { |
3028 const auto* s = call_.GetAudioReceiveStream(ssrc); | 3031 const auto* s = call_.GetAudioReceiveStream(ssrc); |
3029 EXPECT_NE(nullptr, s); | 3032 EXPECT_NE(nullptr, s); |
3030 EXPECT_FALSE(s->GetConfig().combined_audio_video_bwe); | 3033 EXPECT_FALSE(s->GetConfig().combined_audio_video_bwe); |
3031 } | 3034 } |
3032 | 3035 |
3033 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); | 3036 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); |
3034 } | 3037 } |
3035 | 3038 |
3036 TEST_F(WebRtcVoiceEngineTestFake, ConfigureCombinedBweForNewRecvStreams) { | 3039 TEST_F(WebRtcVoiceEngineTestFake, ConfigureCombinedBweForNewRecvStreams) { |
3037 // Test that adding receive streams after enabling combined bandwidth | 3040 // Test that adding receive streams after enabling combined bandwidth |
3038 // estimation will correctly configure each channel. | 3041 // estimation will correctly configure each channel. |
3039 EXPECT_TRUE(SetupEngineWithSendStream()); | 3042 EXPECT_TRUE(SetupEngineWithSendStream()); |
3040 cricket::WebRtcVoiceMediaChannel* media_channel = | 3043 cricket::WebRtcVoiceMediaChannel* media_channel = |
3041 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 3044 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
3042 send_parameters_.options.combined_audio_video_bwe = rtc::Maybe<bool>(true); | 3045 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true); |
3043 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); | 3046 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); |
3044 | 3047 |
3045 static const uint32_t kSsrcs[] = {1, 2, 3, 4}; | 3048 static const uint32_t kSsrcs[] = {1, 2, 3, 4}; |
3046 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs); ++i) { | 3049 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs); ++i) { |
3047 EXPECT_TRUE(media_channel->AddRecvStream( | 3050 EXPECT_TRUE(media_channel->AddRecvStream( |
3048 cricket::StreamParams::CreateLegacy(kSsrcs[i]))); | 3051 cricket::StreamParams::CreateLegacy(kSsrcs[i]))); |
3049 EXPECT_NE(nullptr, call_.GetAudioReceiveStream(kSsrcs[i])); | 3052 EXPECT_NE(nullptr, call_.GetAudioReceiveStream(kSsrcs[i])); |
3050 } | 3053 } |
3051 EXPECT_EQ(ARRAY_SIZE(kSsrcs), call_.GetAudioReceiveStreams().size()); | 3054 EXPECT_EQ(ARRAY_SIZE(kSsrcs), call_.GetAudioReceiveStreams().size()); |
3052 } | 3055 } |
3053 | 3056 |
3054 TEST_F(WebRtcVoiceEngineTestFake, ConfiguresAudioReceiveStreamRtpExtensions) { | 3057 TEST_F(WebRtcVoiceEngineTestFake, ConfiguresAudioReceiveStreamRtpExtensions) { |
3055 // Test that setting the header extensions results in the expected state | 3058 // Test that setting the header extensions results in the expected state |
3056 // changes on an associated Call. | 3059 // changes on an associated Call. |
3057 std::vector<uint32_t> ssrcs; | 3060 std::vector<uint32_t> ssrcs; |
3058 ssrcs.push_back(223); | 3061 ssrcs.push_back(223); |
3059 ssrcs.push_back(224); | 3062 ssrcs.push_back(224); |
3060 | 3063 |
3061 EXPECT_TRUE(SetupEngineWithSendStream()); | 3064 EXPECT_TRUE(SetupEngineWithSendStream()); |
3062 cricket::WebRtcVoiceMediaChannel* media_channel = | 3065 cricket::WebRtcVoiceMediaChannel* media_channel = |
3063 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 3066 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
3064 send_parameters_.options.combined_audio_video_bwe = rtc::Maybe<bool>(true); | 3067 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true); |
3065 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); | 3068 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); |
3066 for (uint32_t ssrc : ssrcs) { | 3069 for (uint32_t ssrc : ssrcs) { |
3067 EXPECT_TRUE(media_channel->AddRecvStream( | 3070 EXPECT_TRUE(media_channel->AddRecvStream( |
3068 cricket::StreamParams::CreateLegacy(ssrc))); | 3071 cricket::StreamParams::CreateLegacy(ssrc))); |
3069 } | 3072 } |
3070 | 3073 |
3071 // Combined BWE should be set up, but with no configured extensions. | 3074 // Combined BWE should be set up, but with no configured extensions. |
3072 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); | 3075 EXPECT_EQ(2, call_.GetAudioReceiveStreams().size()); |
3073 for (uint32_t ssrc : ssrcs) { | 3076 for (uint32_t ssrc : ssrcs) { |
3074 const auto* s = call_.GetAudioReceiveStream(ssrc); | 3077 const auto* s = call_.GetAudioReceiveStream(ssrc); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3113 0x80, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, | 3116 0x80, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, |
3114 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, | 3117 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |
3115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 3118 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 3119 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
3117 }; | 3120 }; |
3118 rtc::Buffer kRtcpPacket(kRtcp, sizeof(kRtcp)); | 3121 rtc::Buffer kRtcpPacket(kRtcp, sizeof(kRtcp)); |
3119 | 3122 |
3120 EXPECT_TRUE(SetupEngineWithSendStream()); | 3123 EXPECT_TRUE(SetupEngineWithSendStream()); |
3121 cricket::WebRtcVoiceMediaChannel* media_channel = | 3124 cricket::WebRtcVoiceMediaChannel* media_channel = |
3122 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 3125 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
3123 send_parameters_.options.combined_audio_video_bwe = rtc::Maybe<bool>(true); | 3126 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true); |
3124 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 3127 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
3125 EXPECT_TRUE(media_channel->AddRecvStream( | 3128 EXPECT_TRUE(media_channel->AddRecvStream( |
3126 cricket::StreamParams::CreateLegacy(kAudioSsrc))); | 3129 cricket::StreamParams::CreateLegacy(kAudioSsrc))); |
3127 | 3130 |
3128 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size()); | 3131 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size()); |
3129 const cricket::FakeAudioReceiveStream* s = | 3132 const cricket::FakeAudioReceiveStream* s = |
3130 call_.GetAudioReceiveStream(kAudioSsrc); | 3133 call_.GetAudioReceiveStream(kAudioSsrc); |
3131 EXPECT_EQ(0, s->received_packets()); | 3134 EXPECT_EQ(0, s->received_packets()); |
3132 channel_->OnPacketReceived(&kPcmuPacket, rtc::PacketTime()); | 3135 channel_->OnPacketReceived(&kPcmuPacket, rtc::PacketTime()); |
3133 EXPECT_EQ(1, s->received_packets()); | 3136 EXPECT_EQ(1, s->received_packets()); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 cricket::WebRtcVoiceEngine engine; | 3318 cricket::WebRtcVoiceEngine engine; |
3316 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3319 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3317 rtc::scoped_ptr<webrtc::Call> call( | 3320 rtc::scoped_ptr<webrtc::Call> call( |
3318 webrtc::Call::Create(webrtc::Call::Config())); | 3321 webrtc::Call::Create(webrtc::Call::Config())); |
3319 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), | 3322 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), |
3320 call.get()); | 3323 call.get()); |
3321 cricket::AudioRecvParameters parameters; | 3324 cricket::AudioRecvParameters parameters; |
3322 parameters.codecs = engine.codecs(); | 3325 parameters.codecs = engine.codecs(); |
3323 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3326 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3324 } | 3327 } |
OLD | NEW |