| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 class WebRtcVoiceEngineTestFake : public testing::Test { | 75 class WebRtcVoiceEngineTestFake : public testing::Test { |
| 76 public: | 76 public: |
| 77 WebRtcVoiceEngineTestFake() | 77 WebRtcVoiceEngineTestFake() |
| 78 : call_(webrtc::Call::Config()), | 78 : call_(webrtc::Call::Config()), |
| 79 engine_(new FakeVoEWrapper(&voe_)), | 79 engine_(new FakeVoEWrapper(&voe_)), |
| 80 channel_(nullptr) { | 80 channel_(nullptr) { |
| 81 send_parameters_.codecs.push_back(kPcmuCodec); | 81 send_parameters_.codecs.push_back(kPcmuCodec); |
| 82 recv_parameters_.codecs.push_back(kPcmuCodec); | 82 recv_parameters_.codecs.push_back(kPcmuCodec); |
| 83 options_adjust_agc_.adjust_agc_delta = rtc::Optional<int>(-10); | |
| 84 } | 83 } |
| 85 bool SetupEngine() { | 84 bool SetupEngine() { |
| 86 if (!engine_.Init(rtc::Thread::Current())) { | 85 if (!engine_.Init(rtc::Thread::Current())) { |
| 87 return false; | 86 return false; |
| 88 } | 87 } |
| 89 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); | 88 channel_ = engine_.CreateChannel(&call_, cricket::AudioOptions()); |
| 90 return (channel_ != nullptr); | 89 return (channel_ != nullptr); |
| 91 } | 90 } |
| 92 bool SetupEngineWithRecvStream() { | 91 bool SetupEngineWithRecvStream() { |
| 93 if (!SetupEngine()) { | 92 if (!SetupEngine()) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 EXPECT_EQ(info.decoding_cng, stats.decoding_cng); | 390 EXPECT_EQ(info.decoding_cng, stats.decoding_cng); |
| 392 EXPECT_EQ(info.decoding_plc_cng, stats.decoding_plc_cng); | 391 EXPECT_EQ(info.decoding_plc_cng, stats.decoding_plc_cng); |
| 393 EXPECT_EQ(info.capture_start_ntp_time_ms, stats.capture_start_ntp_time_ms); | 392 EXPECT_EQ(info.capture_start_ntp_time_ms, stats.capture_start_ntp_time_ms); |
| 394 } | 393 } |
| 395 | 394 |
| 396 protected: | 395 protected: |
| 397 cricket::FakeCall call_; | 396 cricket::FakeCall call_; |
| 398 cricket::FakeWebRtcVoiceEngine voe_; | 397 cricket::FakeWebRtcVoiceEngine voe_; |
| 399 cricket::WebRtcVoiceEngine engine_; | 398 cricket::WebRtcVoiceEngine engine_; |
| 400 cricket::VoiceMediaChannel* channel_; | 399 cricket::VoiceMediaChannel* channel_; |
| 401 | |
| 402 cricket::AudioSendParameters send_parameters_; | 400 cricket::AudioSendParameters send_parameters_; |
| 403 cricket::AudioRecvParameters recv_parameters_; | 401 cricket::AudioRecvParameters recv_parameters_; |
| 404 cricket::AudioOptions options_adjust_agc_; | |
| 405 }; | 402 }; |
| 406 | 403 |
| 407 // Tests that our stub library "works". | 404 // Tests that our stub library "works". |
| 408 TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) { | 405 TEST_F(WebRtcVoiceEngineTestFake, StartupShutdown) { |
| 409 EXPECT_FALSE(voe_.IsInited()); | 406 EXPECT_FALSE(voe_.IsInited()); |
| 410 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); | 407 EXPECT_TRUE(engine_.Init(rtc::Thread::Current())); |
| 411 EXPECT_TRUE(voe_.IsInited()); | 408 EXPECT_TRUE(voe_.IsInited()); |
| 412 engine_.Terminate(); | 409 engine_.Terminate(); |
| 413 EXPECT_FALSE(voe_.IsInited()); | 410 EXPECT_FALSE(voe_.IsInited()); |
| 414 } | 411 } |
| (...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); | 2151 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); |
| 2155 EXPECT_TRUE(voe_.GetPlayout(channel_num2)); | 2152 EXPECT_TRUE(voe_.GetPlayout(channel_num2)); |
| 2156 EXPECT_TRUE(voe_.GetPlayout(channel_num3)); | 2153 EXPECT_TRUE(voe_.GetPlayout(channel_num3)); |
| 2157 | 2154 |
| 2158 // Now remove the recv streams and verify that the send stream doesn't play. | 2155 // Now remove the recv streams and verify that the send stream doesn't play. |
| 2159 EXPECT_TRUE(channel_->RemoveRecvStream(3)); | 2156 EXPECT_TRUE(channel_->RemoveRecvStream(3)); |
| 2160 EXPECT_TRUE(channel_->RemoveRecvStream(2)); | 2157 EXPECT_TRUE(channel_->RemoveRecvStream(2)); |
| 2161 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); | 2158 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); |
| 2162 } | 2159 } |
| 2163 | 2160 |
| 2164 // Test that we can set the devices to use. | |
| 2165 TEST_F(WebRtcVoiceEngineTestFake, SetDevices) { | |
| 2166 EXPECT_TRUE(SetupEngineWithSendStream()); | |
| 2167 int send_channel = voe_.GetLastChannel(); | |
| 2168 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2))); | |
| 2169 int recv_channel = voe_.GetLastChannel(); | |
| 2170 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | |
| 2171 | |
| 2172 cricket::Device default_dev(cricket::kFakeDefaultDeviceName, | |
| 2173 cricket::kFakeDefaultDeviceId); | |
| 2174 cricket::Device dev(cricket::kFakeDeviceName, | |
| 2175 cricket::kFakeDeviceId); | |
| 2176 | |
| 2177 // Test SetDevices() while not sending or playing. | |
| 2178 EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev)); | |
| 2179 | |
| 2180 // Test SetDevices() while sending and playing. | |
| 2181 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); | |
| 2182 EXPECT_TRUE(channel_->SetPlayout(true)); | |
| 2183 EXPECT_TRUE(voe_.GetSend(send_channel)); | |
| 2184 EXPECT_TRUE(voe_.GetPlayout(recv_channel)); | |
| 2185 | |
| 2186 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); | |
| 2187 | |
| 2188 EXPECT_TRUE(voe_.GetSend(send_channel)); | |
| 2189 EXPECT_TRUE(voe_.GetPlayout(recv_channel)); | |
| 2190 | |
| 2191 // Test that failure to open newly selected devices does not prevent opening | |
| 2192 // ones after that. | |
| 2193 voe_.set_playout_fail_channel(recv_channel); | |
| 2194 voe_.set_send_fail_channel(send_channel); | |
| 2195 | |
| 2196 EXPECT_FALSE(engine_.SetDevices(&default_dev, &default_dev)); | |
| 2197 | |
| 2198 EXPECT_FALSE(voe_.GetSend(send_channel)); | |
| 2199 EXPECT_FALSE(voe_.GetPlayout(recv_channel)); | |
| 2200 | |
| 2201 voe_.set_playout_fail_channel(-1); | |
| 2202 voe_.set_send_fail_channel(-1); | |
| 2203 | |
| 2204 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); | |
| 2205 | |
| 2206 EXPECT_TRUE(voe_.GetSend(send_channel)); | |
| 2207 EXPECT_TRUE(voe_.GetPlayout(recv_channel)); | |
| 2208 } | |
| 2209 | |
| 2210 // Test that we can set the devices to use even if we failed to | |
| 2211 // open the initial ones. | |
| 2212 TEST_F(WebRtcVoiceEngineTestFake, SetDevicesWithInitiallyBadDevices) { | |
| 2213 EXPECT_TRUE(SetupEngineWithSendStream()); | |
| 2214 int send_channel = voe_.GetLastChannel(); | |
| 2215 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2))); | |
| 2216 int recv_channel = voe_.GetLastChannel(); | |
| 2217 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | |
| 2218 | |
| 2219 cricket::Device default_dev(cricket::kFakeDefaultDeviceName, | |
| 2220 cricket::kFakeDefaultDeviceId); | |
| 2221 cricket::Device dev(cricket::kFakeDeviceName, | |
| 2222 cricket::kFakeDeviceId); | |
| 2223 | |
| 2224 // Test that failure to open devices selected before starting | |
| 2225 // send/play does not prevent opening newly selected ones after that. | |
| 2226 voe_.set_playout_fail_channel(recv_channel); | |
| 2227 voe_.set_send_fail_channel(send_channel); | |
| 2228 | |
| 2229 EXPECT_TRUE(engine_.SetDevices(&default_dev, &default_dev)); | |
| 2230 | |
| 2231 EXPECT_FALSE(channel_->SetSend(cricket::SEND_MICROPHONE)); | |
| 2232 EXPECT_FALSE(channel_->SetPlayout(true)); | |
| 2233 EXPECT_FALSE(voe_.GetSend(send_channel)); | |
| 2234 EXPECT_FALSE(voe_.GetPlayout(recv_channel)); | |
| 2235 | |
| 2236 voe_.set_playout_fail_channel(-1); | |
| 2237 voe_.set_send_fail_channel(-1); | |
| 2238 | |
| 2239 EXPECT_TRUE(engine_.SetDevices(&dev, &dev)); | |
| 2240 | |
| 2241 EXPECT_TRUE(voe_.GetSend(send_channel)); | |
| 2242 EXPECT_TRUE(voe_.GetPlayout(recv_channel)); | |
| 2243 } | |
| 2244 | |
| 2245 // Test that we can create a channel configured for Codian bridges, | 2161 // Test that we can create a channel configured for Codian bridges, |
| 2246 // and start sending on it. | 2162 // and start sending on it. |
| 2247 TEST_F(WebRtcVoiceEngineTestFake, CodianSend) { | 2163 TEST_F(WebRtcVoiceEngineTestFake, CodianSend) { |
| 2248 EXPECT_TRUE(SetupEngineWithSendStream()); | 2164 EXPECT_TRUE(SetupEngineWithSendStream()); |
| 2165 cricket::AudioOptions options_adjust_agc; |
| 2166 options_adjust_agc.adjust_agc_delta = rtc::Optional<int>(-10); |
| 2249 int channel_num = voe_.GetLastChannel(); | 2167 int channel_num = voe_.GetLastChannel(); |
| 2250 webrtc::AgcConfig agc_config; | 2168 webrtc::AgcConfig agc_config; |
| 2251 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2169 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
| 2252 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2170 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
| 2253 send_parameters_.options = options_adjust_agc_; | 2171 send_parameters_.options = options_adjust_agc; |
| 2254 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2172 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2255 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); | 2173 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); |
| 2256 EXPECT_TRUE(voe_.GetSend(channel_num)); | 2174 EXPECT_TRUE(voe_.GetSend(channel_num)); |
| 2257 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2175 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
| 2258 EXPECT_EQ(agc_config.targetLeveldBOv, 10); // level was attenuated | 2176 EXPECT_EQ(agc_config.targetLeveldBOv, 10); // level was attenuated |
| 2259 EXPECT_TRUE(channel_->SetSend(cricket::SEND_NOTHING)); | 2177 EXPECT_TRUE(channel_->SetSend(cricket::SEND_NOTHING)); |
| 2260 EXPECT_FALSE(voe_.GetSend(channel_num)); | 2178 EXPECT_FALSE(voe_.GetSend(channel_num)); |
| 2261 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2179 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
| 2262 EXPECT_EQ(0, agc_config.targetLeveldBOv); // level was restored | |
| 2263 } | 2180 } |
| 2264 | 2181 |
| 2265 TEST_F(WebRtcVoiceEngineTestFake, TxAgcConfigViaOptions) { | 2182 TEST_F(WebRtcVoiceEngineTestFake, TxAgcConfigViaOptions) { |
| 2266 EXPECT_TRUE(SetupEngineWithSendStream()); | 2183 EXPECT_TRUE(SetupEngineWithSendStream()); |
| 2267 webrtc::AgcConfig agc_config; | 2184 webrtc::AgcConfig agc_config; |
| 2268 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2185 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
| 2269 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2186 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
| 2270 | 2187 send_parameters_.options.tx_agc_target_dbov = rtc::Optional<uint16_t>(3); |
| 2271 cricket::AudioOptions options; | 2188 send_parameters_.options.tx_agc_digital_compression_gain = |
| 2272 options.tx_agc_target_dbov = rtc::Optional<uint16_t>(3); | 2189 rtc::Optional<uint16_t>(9); |
| 2273 options.tx_agc_digital_compression_gain = rtc::Optional<uint16_t>(9); | 2190 send_parameters_.options.tx_agc_limiter = rtc::Optional<bool>(true); |
| 2274 options.tx_agc_limiter = rtc::Optional<bool>(true); | 2191 send_parameters_.options.auto_gain_control = rtc::Optional<bool>(true); |
| 2275 options.auto_gain_control = rtc::Optional<bool>(true); | 2192 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2276 EXPECT_TRUE(engine_.SetOptions(options)); | |
| 2277 | |
| 2278 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2193 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
| 2279 EXPECT_EQ(3, agc_config.targetLeveldBOv); | 2194 EXPECT_EQ(3, agc_config.targetLeveldBOv); |
| 2280 EXPECT_EQ(9, agc_config.digitalCompressionGaindB); | 2195 EXPECT_EQ(9, agc_config.digitalCompressionGaindB); |
| 2281 EXPECT_TRUE(agc_config.limiterEnable); | 2196 EXPECT_TRUE(agc_config.limiterEnable); |
| 2282 | 2197 |
| 2283 // Check interaction with adjust_agc_delta. Both should be respected, for | 2198 // Check interaction with adjust_agc_delta. Both should be respected, for |
| 2284 // backwards compatibility. | 2199 // backwards compatibility. |
| 2285 options.adjust_agc_delta = rtc::Optional<int>(-10); | 2200 send_parameters_.options.adjust_agc_delta = rtc::Optional<int>(-10); |
| 2286 EXPECT_TRUE(engine_.SetOptions(options)); | 2201 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2287 | |
| 2288 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2202 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
| 2289 EXPECT_EQ(13, agc_config.targetLeveldBOv); | 2203 EXPECT_EQ(13, agc_config.targetLeveldBOv); |
| 2290 } | 2204 } |
| 2291 | 2205 |
| 2292 TEST_F(WebRtcVoiceEngineTestFake, SampleRatesViaOptions) { | 2206 TEST_F(WebRtcVoiceEngineTestFake, SampleRatesViaOptions) { |
| 2293 EXPECT_TRUE(SetupEngineWithSendStream()); | 2207 EXPECT_TRUE(SetupEngineWithSendStream()); |
| 2294 cricket::AudioOptions options; | 2208 send_parameters_.options.recording_sample_rate = |
| 2295 options.recording_sample_rate = rtc::Optional<uint32_t>(48000); | 2209 rtc::Optional<uint32_t>(48000); |
| 2296 options.playout_sample_rate = rtc::Optional<uint32_t>(44100); | 2210 send_parameters_.options.playout_sample_rate = rtc::Optional<uint32_t>(44100); |
| 2297 EXPECT_TRUE(engine_.SetOptions(options)); | 2211 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2298 | 2212 |
| 2299 unsigned int recording_sample_rate, playout_sample_rate; | 2213 unsigned int recording_sample_rate, playout_sample_rate; |
| 2300 EXPECT_EQ(0, voe_.RecordingSampleRate(&recording_sample_rate)); | 2214 EXPECT_EQ(0, voe_.RecordingSampleRate(&recording_sample_rate)); |
| 2301 EXPECT_EQ(0, voe_.PlayoutSampleRate(&playout_sample_rate)); | 2215 EXPECT_EQ(0, voe_.PlayoutSampleRate(&playout_sample_rate)); |
| 2302 EXPECT_EQ(48000u, recording_sample_rate); | 2216 EXPECT_EQ(48000u, recording_sample_rate); |
| 2303 EXPECT_EQ(44100u, playout_sample_rate); | 2217 EXPECT_EQ(44100u, playout_sample_rate); |
| 2304 } | 2218 } |
| 2305 | 2219 |
| 2306 // Test that we can set the outgoing SSRC properly. | 2220 // Test that we can set the outgoing SSRC properly. |
| 2307 // SSRC is set in SetupEngine by calling AddSendStream. | 2221 // SSRC is set in SetupEngine by calling AddSendStream. |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2631 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2545 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
| 2632 EXPECT_FALSE(cng_enabled); | 2546 EXPECT_FALSE(cng_enabled); |
| 2633 EXPECT_TRUE(agc_enabled); | 2547 EXPECT_TRUE(agc_enabled); |
| 2634 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2548 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
| 2635 EXPECT_TRUE(ns_enabled); | 2549 EXPECT_TRUE(ns_enabled); |
| 2636 EXPECT_TRUE(highpass_filter_enabled); | 2550 EXPECT_TRUE(highpass_filter_enabled); |
| 2637 EXPECT_FALSE(stereo_swapping_enabled); | 2551 EXPECT_FALSE(stereo_swapping_enabled); |
| 2638 EXPECT_TRUE(typing_detection_enabled); | 2552 EXPECT_TRUE(typing_detection_enabled); |
| 2639 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2553 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
| 2640 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); | 2554 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); |
| 2555 EXPECT_EQ(50, voe_.GetNetEqCapacity()); |
| 2556 EXPECT_FALSE(voe_.GetNetEqFastAccelerate()); |
| 2641 | 2557 |
| 2642 // Nothing set, so all ignored. | 2558 // Nothing set in AudioOptions, so everything should be as default. |
| 2643 cricket::AudioOptions options; | 2559 send_parameters_.options = cricket::AudioOptions(); |
| 2644 ASSERT_TRUE(engine_.SetOptions(options)); | 2560 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2645 voe_.GetEcStatus(ec_enabled, ec_mode); | 2561 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2646 voe_.GetAecmMode(aecm_mode, cng_enabled); | 2562 voe_.GetAecmMode(aecm_mode, cng_enabled); |
| 2647 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2563 voe_.GetAgcStatus(agc_enabled, agc_mode); |
| 2648 voe_.GetAgcConfig(agc_config); | 2564 voe_.GetAgcConfig(agc_config); |
| 2649 voe_.GetNsStatus(ns_enabled, ns_mode); | 2565 voe_.GetNsStatus(ns_enabled, ns_mode); |
| 2650 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); | 2566 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); |
| 2651 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); | 2567 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); |
| 2652 voe_.GetTypingDetectionStatus(typing_detection_enabled); | 2568 voe_.GetTypingDetectionStatus(typing_detection_enabled); |
| 2653 EXPECT_TRUE(ec_enabled); | 2569 EXPECT_TRUE(ec_enabled); |
| 2654 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2570 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
| 2655 EXPECT_FALSE(cng_enabled); | 2571 EXPECT_FALSE(cng_enabled); |
| 2656 EXPECT_TRUE(agc_enabled); | 2572 EXPECT_TRUE(agc_enabled); |
| 2657 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2573 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
| 2658 EXPECT_TRUE(ns_enabled); | 2574 EXPECT_TRUE(ns_enabled); |
| 2659 EXPECT_TRUE(highpass_filter_enabled); | 2575 EXPECT_TRUE(highpass_filter_enabled); |
| 2660 EXPECT_FALSE(stereo_swapping_enabled); | 2576 EXPECT_FALSE(stereo_swapping_enabled); |
| 2661 EXPECT_TRUE(typing_detection_enabled); | 2577 EXPECT_TRUE(typing_detection_enabled); |
| 2662 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2578 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
| 2663 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); | 2579 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); |
| 2664 EXPECT_EQ(50, voe_.GetNetEqCapacity()); // From GetDefaultEngineOptions(). | 2580 EXPECT_EQ(50, voe_.GetNetEqCapacity()); |
| 2665 EXPECT_FALSE( | 2581 EXPECT_FALSE(voe_.GetNetEqFastAccelerate()); |
| 2666 voe_.GetNetEqFastAccelerate()); // From GetDefaultEngineOptions(). | |
| 2667 | 2582 |
| 2668 // Turn echo cancellation off | 2583 // Turn echo cancellation off |
| 2669 options.echo_cancellation = rtc::Optional<bool>(false); | 2584 send_parameters_.options.echo_cancellation = rtc::Optional<bool>(false); |
| 2670 ASSERT_TRUE(engine_.SetOptions(options)); | 2585 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2671 voe_.GetEcStatus(ec_enabled, ec_mode); | 2586 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2672 EXPECT_FALSE(ec_enabled); | 2587 EXPECT_FALSE(ec_enabled); |
| 2673 | 2588 |
| 2674 // Turn echo cancellation back on, with settings, and make sure | 2589 // Turn echo cancellation back on, with settings, and make sure |
| 2675 // nothing else changed. | 2590 // nothing else changed. |
| 2676 options.echo_cancellation = rtc::Optional<bool>(true); | 2591 send_parameters_.options.echo_cancellation = rtc::Optional<bool>(true); |
| 2677 ASSERT_TRUE(engine_.SetOptions(options)); | 2592 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2678 voe_.GetEcStatus(ec_enabled, ec_mode); | 2593 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2679 voe_.GetAecmMode(aecm_mode, cng_enabled); | 2594 voe_.GetAecmMode(aecm_mode, cng_enabled); |
| 2680 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2595 voe_.GetAgcStatus(agc_enabled, agc_mode); |
| 2681 voe_.GetAgcConfig(agc_config); | 2596 voe_.GetAgcConfig(agc_config); |
| 2682 voe_.GetNsStatus(ns_enabled, ns_mode); | 2597 voe_.GetNsStatus(ns_enabled, ns_mode); |
| 2683 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); | 2598 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); |
| 2684 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); | 2599 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); |
| 2685 voe_.GetTypingDetectionStatus(typing_detection_enabled); | 2600 voe_.GetTypingDetectionStatus(typing_detection_enabled); |
| 2686 EXPECT_TRUE(ec_enabled); | 2601 EXPECT_TRUE(ec_enabled); |
| 2687 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2602 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
| 2688 EXPECT_TRUE(agc_enabled); | 2603 EXPECT_TRUE(agc_enabled); |
| 2689 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2604 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
| 2690 EXPECT_TRUE(ns_enabled); | 2605 EXPECT_TRUE(ns_enabled); |
| 2691 EXPECT_TRUE(highpass_filter_enabled); | 2606 EXPECT_TRUE(highpass_filter_enabled); |
| 2692 EXPECT_FALSE(stereo_swapping_enabled); | 2607 EXPECT_FALSE(stereo_swapping_enabled); |
| 2693 EXPECT_TRUE(typing_detection_enabled); | 2608 EXPECT_TRUE(typing_detection_enabled); |
| 2694 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2609 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
| 2695 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); | 2610 EXPECT_EQ(ns_mode, webrtc::kNsHighSuppression); |
| 2696 | 2611 |
| 2697 // Turn on delay agnostic aec and make sure nothing change w.r.t. echo | 2612 // Turn on delay agnostic aec and make sure nothing change w.r.t. echo |
| 2698 // control. | 2613 // control. |
| 2699 options.delay_agnostic_aec = rtc::Optional<bool>(true); | 2614 send_parameters_.options.delay_agnostic_aec = rtc::Optional<bool>(true); |
| 2700 ASSERT_TRUE(engine_.SetOptions(options)); | 2615 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2701 voe_.GetEcStatus(ec_enabled, ec_mode); | 2616 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2702 voe_.GetAecmMode(aecm_mode, cng_enabled); | 2617 voe_.GetAecmMode(aecm_mode, cng_enabled); |
| 2703 EXPECT_TRUE(ec_enabled); | 2618 EXPECT_TRUE(ec_enabled); |
| 2704 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2619 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
| 2705 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2620 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
| 2706 | 2621 |
| 2707 // Turn off echo cancellation and delay agnostic aec. | 2622 // Turn off echo cancellation and delay agnostic aec. |
| 2708 options.delay_agnostic_aec = rtc::Optional<bool>(false); | 2623 send_parameters_.options.delay_agnostic_aec = rtc::Optional<bool>(false); |
| 2709 options.extended_filter_aec = rtc::Optional<bool>(false); | 2624 send_parameters_.options.extended_filter_aec = rtc::Optional<bool>(false); |
| 2710 options.echo_cancellation = rtc::Optional<bool>(false); | 2625 send_parameters_.options.echo_cancellation = rtc::Optional<bool>(false); |
| 2711 ASSERT_TRUE(engine_.SetOptions(options)); | 2626 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2712 voe_.GetEcStatus(ec_enabled, ec_mode); | 2627 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2713 EXPECT_FALSE(ec_enabled); | 2628 EXPECT_FALSE(ec_enabled); |
| 2714 // Turning delay agnostic aec back on should also turn on echo cancellation. | 2629 // Turning delay agnostic aec back on should also turn on echo cancellation. |
| 2715 options.delay_agnostic_aec = rtc::Optional<bool>(true); | 2630 send_parameters_.options.delay_agnostic_aec = rtc::Optional<bool>(true); |
| 2716 ASSERT_TRUE(engine_.SetOptions(options)); | 2631 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2717 voe_.GetEcStatus(ec_enabled, ec_mode); | 2632 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2718 EXPECT_TRUE(ec_enabled); | 2633 EXPECT_TRUE(ec_enabled); |
| 2719 EXPECT_TRUE(voe_.ec_metrics_enabled()); | 2634 EXPECT_TRUE(voe_.ec_metrics_enabled()); |
| 2720 EXPECT_EQ(ec_mode, webrtc::kEcConference); | 2635 EXPECT_EQ(ec_mode, webrtc::kEcConference); |
| 2721 | 2636 |
| 2722 // Turn off AGC | 2637 // Turn off AGC |
| 2723 options.auto_gain_control = rtc::Optional<bool>(false); | 2638 send_parameters_.options.auto_gain_control = rtc::Optional<bool>(false); |
| 2724 ASSERT_TRUE(engine_.SetOptions(options)); | 2639 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2725 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2640 voe_.GetAgcStatus(agc_enabled, agc_mode); |
| 2726 EXPECT_FALSE(agc_enabled); | 2641 EXPECT_FALSE(agc_enabled); |
| 2727 | 2642 |
| 2728 // Turn AGC back on | 2643 // Turn AGC back on |
| 2729 options.auto_gain_control = rtc::Optional<bool>(true); | 2644 send_parameters_.options.auto_gain_control = rtc::Optional<bool>(true); |
| 2730 options.adjust_agc_delta = rtc::Optional<int>(); | 2645 send_parameters_.options.adjust_agc_delta = rtc::Optional<int>(); |
| 2731 ASSERT_TRUE(engine_.SetOptions(options)); | 2646 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2732 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2647 voe_.GetAgcStatus(agc_enabled, agc_mode); |
| 2733 EXPECT_TRUE(agc_enabled); | 2648 EXPECT_TRUE(agc_enabled); |
| 2734 voe_.GetAgcConfig(agc_config); | 2649 voe_.GetAgcConfig(agc_config); |
| 2735 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2650 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
| 2736 | 2651 |
| 2737 // Turn off other options (and stereo swapping on). | 2652 // Turn off other options (and stereo swapping on). |
| 2738 options.noise_suppression = rtc::Optional<bool>(false); | 2653 send_parameters_.options.noise_suppression = rtc::Optional<bool>(false); |
| 2739 options.highpass_filter = rtc::Optional<bool>(false); | 2654 send_parameters_.options.highpass_filter = rtc::Optional<bool>(false); |
| 2740 options.typing_detection = rtc::Optional<bool>(false); | 2655 send_parameters_.options.typing_detection = rtc::Optional<bool>(false); |
| 2741 options.stereo_swapping = rtc::Optional<bool>(true); | 2656 send_parameters_.options.stereo_swapping = rtc::Optional<bool>(true); |
| 2742 ASSERT_TRUE(engine_.SetOptions(options)); | 2657 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2743 voe_.GetNsStatus(ns_enabled, ns_mode); | 2658 voe_.GetNsStatus(ns_enabled, ns_mode); |
| 2744 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); | 2659 highpass_filter_enabled = voe_.IsHighPassFilterEnabled(); |
| 2745 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); | 2660 stereo_swapping_enabled = voe_.IsStereoChannelSwappingEnabled(); |
| 2746 voe_.GetTypingDetectionStatus(typing_detection_enabled); | 2661 voe_.GetTypingDetectionStatus(typing_detection_enabled); |
| 2747 EXPECT_FALSE(ns_enabled); | 2662 EXPECT_FALSE(ns_enabled); |
| 2748 EXPECT_FALSE(highpass_filter_enabled); | 2663 EXPECT_FALSE(highpass_filter_enabled); |
| 2749 EXPECT_FALSE(typing_detection_enabled); | 2664 EXPECT_FALSE(typing_detection_enabled); |
| 2750 EXPECT_TRUE(stereo_swapping_enabled); | 2665 EXPECT_TRUE(stereo_swapping_enabled); |
| 2751 | 2666 |
| 2752 // Set options again to ensure it has no impact. | 2667 // Set options again to ensure it has no impact. |
| 2753 ASSERT_TRUE(engine_.SetOptions(options)); | 2668 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 2754 voe_.GetEcStatus(ec_enabled, ec_mode); | 2669 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2755 voe_.GetNsStatus(ns_enabled, ns_mode); | 2670 voe_.GetNsStatus(ns_enabled, ns_mode); |
| 2756 EXPECT_TRUE(ec_enabled); | 2671 EXPECT_TRUE(ec_enabled); |
| 2757 EXPECT_EQ(webrtc::kEcConference, ec_mode); | 2672 EXPECT_EQ(webrtc::kEcConference, ec_mode); |
| 2758 EXPECT_FALSE(ns_enabled); | 2673 EXPECT_FALSE(ns_enabled); |
| 2759 EXPECT_EQ(webrtc::kNsHighSuppression, ns_mode); | 2674 EXPECT_EQ(webrtc::kNsHighSuppression, ns_mode); |
| 2760 } | 2675 } |
| 2761 | 2676 |
| 2762 TEST_F(WebRtcVoiceEngineTestFake, DefaultOptions) { | 2677 TEST_F(WebRtcVoiceEngineTestFake, DefaultOptions) { |
| 2763 EXPECT_TRUE(SetupEngineWithSendStream()); | 2678 EXPECT_TRUE(SetupEngineWithSendStream()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 // unset AGC | 2758 // unset AGC |
| 2844 cricket::AudioSendParameters parameters_options_no_agc = send_parameters_; | 2759 cricket::AudioSendParameters parameters_options_no_agc = send_parameters_; |
| 2845 parameters_options_no_agc.options.auto_gain_control = | 2760 parameters_options_no_agc.options.auto_gain_control = |
| 2846 rtc::Optional<bool>(false); | 2761 rtc::Optional<bool>(false); |
| 2847 ASSERT_TRUE(channel2->SetSendParameters(parameters_options_no_agc)); | 2762 ASSERT_TRUE(channel2->SetSendParameters(parameters_options_no_agc)); |
| 2848 expected_options.echo_cancellation = rtc::Optional<bool>(true); | 2763 expected_options.echo_cancellation = rtc::Optional<bool>(true); |
| 2849 expected_options.auto_gain_control = rtc::Optional<bool>(false); | 2764 expected_options.auto_gain_control = rtc::Optional<bool>(false); |
| 2850 expected_options.noise_suppression = rtc::Optional<bool>(true); | 2765 expected_options.noise_suppression = rtc::Optional<bool>(true); |
| 2851 EXPECT_EQ(expected_options, channel2->options()); | 2766 EXPECT_EQ(expected_options, channel2->options()); |
| 2852 | 2767 |
| 2853 ASSERT_TRUE(engine_.SetOptions(parameters_options_all.options)); | 2768 ASSERT_TRUE(channel_->SetSendParameters(parameters_options_all)); |
| 2854 bool ec_enabled; | 2769 bool ec_enabled; |
| 2855 webrtc::EcModes ec_mode; | 2770 webrtc::EcModes ec_mode; |
| 2856 bool agc_enabled; | 2771 bool agc_enabled; |
| 2857 webrtc::AgcModes agc_mode; | 2772 webrtc::AgcModes agc_mode; |
| 2858 bool ns_enabled; | 2773 bool ns_enabled; |
| 2859 webrtc::NsModes ns_mode; | 2774 webrtc::NsModes ns_mode; |
| 2860 voe_.GetEcStatus(ec_enabled, ec_mode); | 2775 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2861 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2776 voe_.GetAgcStatus(agc_enabled, agc_mode); |
| 2862 voe_.GetNsStatus(ns_enabled, ns_mode); | 2777 voe_.GetNsStatus(ns_enabled, ns_mode); |
| 2863 EXPECT_TRUE(ec_enabled); | 2778 EXPECT_TRUE(ec_enabled); |
| 2864 EXPECT_TRUE(agc_enabled); | 2779 EXPECT_TRUE(agc_enabled); |
| 2865 EXPECT_TRUE(ns_enabled); | 2780 EXPECT_TRUE(ns_enabled); |
| 2866 | 2781 |
| 2867 channel1->SetSend(cricket::SEND_MICROPHONE); | 2782 channel1->SetSend(cricket::SEND_MICROPHONE); |
| 2868 voe_.GetEcStatus(ec_enabled, ec_mode); | 2783 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2869 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2784 voe_.GetAgcStatus(agc_enabled, agc_mode); |
| 2870 voe_.GetNsStatus(ns_enabled, ns_mode); | 2785 voe_.GetNsStatus(ns_enabled, ns_mode); |
| 2871 EXPECT_TRUE(ec_enabled); | 2786 EXPECT_TRUE(ec_enabled); |
| 2872 EXPECT_TRUE(agc_enabled); | 2787 EXPECT_TRUE(agc_enabled); |
| 2873 EXPECT_FALSE(ns_enabled); | 2788 EXPECT_FALSE(ns_enabled); |
| 2874 | 2789 |
| 2875 channel1->SetSend(cricket::SEND_NOTHING); | |
| 2876 voe_.GetEcStatus(ec_enabled, ec_mode); | |
| 2877 voe_.GetAgcStatus(agc_enabled, agc_mode); | |
| 2878 voe_.GetNsStatus(ns_enabled, ns_mode); | |
| 2879 EXPECT_TRUE(ec_enabled); | |
| 2880 EXPECT_TRUE(agc_enabled); | |
| 2881 EXPECT_TRUE(ns_enabled); | |
| 2882 | |
| 2883 channel2->SetSend(cricket::SEND_MICROPHONE); | 2790 channel2->SetSend(cricket::SEND_MICROPHONE); |
| 2884 voe_.GetEcStatus(ec_enabled, ec_mode); | 2791 voe_.GetEcStatus(ec_enabled, ec_mode); |
| 2885 voe_.GetAgcStatus(agc_enabled, agc_mode); | 2792 voe_.GetAgcStatus(agc_enabled, agc_mode); |
| 2886 voe_.GetNsStatus(ns_enabled, ns_mode); | 2793 voe_.GetNsStatus(ns_enabled, ns_mode); |
| 2887 EXPECT_TRUE(ec_enabled); | 2794 EXPECT_TRUE(ec_enabled); |
| 2888 EXPECT_FALSE(agc_enabled); | 2795 EXPECT_FALSE(agc_enabled); |
| 2889 EXPECT_TRUE(ns_enabled); | 2796 EXPECT_TRUE(ns_enabled); |
| 2890 | 2797 |
| 2891 channel2->SetSend(cricket::SEND_NOTHING); | |
| 2892 voe_.GetEcStatus(ec_enabled, ec_mode); | |
| 2893 voe_.GetAgcStatus(agc_enabled, agc_mode); | |
| 2894 voe_.GetNsStatus(ns_enabled, ns_mode); | |
| 2895 EXPECT_TRUE(ec_enabled); | |
| 2896 EXPECT_TRUE(agc_enabled); | |
| 2897 EXPECT_TRUE(ns_enabled); | |
| 2898 | |
| 2899 // Make sure settings take effect while we are sending. | 2798 // Make sure settings take effect while we are sending. |
| 2900 ASSERT_TRUE(engine_.SetOptions(parameters_options_all.options)); | 2799 ASSERT_TRUE(channel_->SetSendParameters(parameters_options_all)); |
| 2901 cricket::AudioSendParameters parameters_options_no_agc_nor_ns = | 2800 cricket::AudioSendParameters parameters_options_no_agc_nor_ns = |
| 2902 send_parameters_; | 2801 send_parameters_; |
| 2903 parameters_options_no_agc_nor_ns.options.auto_gain_control = | 2802 parameters_options_no_agc_nor_ns.options.auto_gain_control = |
| 2904 rtc::Optional<bool>(false); | 2803 rtc::Optional<bool>(false); |
| 2905 parameters_options_no_agc_nor_ns.options.noise_suppression = | 2804 parameters_options_no_agc_nor_ns.options.noise_suppression = |
| 2906 rtc::Optional<bool>(false); | 2805 rtc::Optional<bool>(false); |
| 2907 channel2->SetSend(cricket::SEND_MICROPHONE); | 2806 channel2->SetSend(cricket::SEND_MICROPHONE); |
| 2908 channel2->SetSendParameters(parameters_options_no_agc_nor_ns); | 2807 channel2->SetSendParameters(parameters_options_no_agc_nor_ns); |
| 2909 expected_options.echo_cancellation = rtc::Optional<bool>(true); | 2808 expected_options.echo_cancellation = rtc::Optional<bool>(true); |
| 2910 expected_options.auto_gain_control = rtc::Optional<bool>(false); | 2809 expected_options.auto_gain_control = rtc::Optional<bool>(false); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3065 | 2964 |
| 3066 TEST_F(WebRtcVoiceEngineTestFake, ConfigureCombinedBweForNewRecvStreams) { | 2965 TEST_F(WebRtcVoiceEngineTestFake, ConfigureCombinedBweForNewRecvStreams) { |
| 3067 // Test that adding receive streams after enabling combined bandwidth | 2966 // Test that adding receive streams after enabling combined bandwidth |
| 3068 // estimation will correctly configure each channel. | 2967 // estimation will correctly configure each channel. |
| 3069 EXPECT_TRUE(SetupEngineWithSendStream()); | 2968 EXPECT_TRUE(SetupEngineWithSendStream()); |
| 3070 cricket::WebRtcVoiceMediaChannel* media_channel = | 2969 cricket::WebRtcVoiceMediaChannel* media_channel = |
| 3071 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 2970 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
| 3072 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true); | 2971 send_parameters_.options.combined_audio_video_bwe = rtc::Optional<bool>(true); |
| 3073 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); | 2972 EXPECT_TRUE(media_channel->SetSendParameters(send_parameters_)); |
| 3074 | 2973 |
| 3075 static const uint32_t kSsrcs[] = {1, 2, 3, 4}; | 2974 for (uint32_t ssrc : kSsrcs4) { |
| 3076 for (unsigned int i = 0; i < arraysize(kSsrcs); ++i) { | |
| 3077 EXPECT_TRUE(media_channel->AddRecvStream( | 2975 EXPECT_TRUE(media_channel->AddRecvStream( |
| 3078 cricket::StreamParams::CreateLegacy(kSsrcs[i]))); | 2976 cricket::StreamParams::CreateLegacy(ssrc))); |
| 3079 EXPECT_NE(nullptr, call_.GetAudioReceiveStream(kSsrcs[i])); | 2977 EXPECT_NE(nullptr, call_.GetAudioReceiveStream(ssrc)); |
| 3080 } | 2978 } |
| 3081 EXPECT_EQ(arraysize(kSsrcs), call_.GetAudioReceiveStreams().size()); | 2979 EXPECT_EQ(arraysize(kSsrcs4), call_.GetAudioReceiveStreams().size()); |
| 3082 } | 2980 } |
| 3083 | 2981 |
| 3084 // TODO(solenberg): Remove, once recv streams are configured through Call. | 2982 // TODO(solenberg): Remove, once recv streams are configured through Call. |
| 3085 // (This is then covered by TestSetRecvRtpHeaderExtensions.) | 2983 // (This is then covered by TestSetRecvRtpHeaderExtensions.) |
| 3086 TEST_F(WebRtcVoiceEngineTestFake, ConfiguresAudioReceiveStreamRtpExtensions) { | 2984 TEST_F(WebRtcVoiceEngineTestFake, ConfiguresAudioReceiveStreamRtpExtensions) { |
| 3087 // Test that setting the header extensions results in the expected state | 2985 // Test that setting the header extensions results in the expected state |
| 3088 // changes on an associated Call. | 2986 // changes on an associated Call. |
| 3089 std::vector<uint32_t> ssrcs; | 2987 std::vector<uint32_t> ssrcs; |
| 3090 ssrcs.push_back(223); | 2988 ssrcs.push_back(223); |
| 3091 ssrcs.push_back(224); | 2989 ssrcs.push_back(224); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 // channel of |recv_ch|.This is not a common case, since, normally, only the | 3098 // channel of |recv_ch|.This is not a common case, since, normally, only the |
| 3201 // default channel can be associated. However, the default is not deletable. | 3099 // default channel can be associated. However, the default is not deletable. |
| 3202 // So we force the |recv_ch| to associate with a non-default channel. | 3100 // So we force the |recv_ch| to associate with a non-default channel. |
| 3203 EXPECT_EQ(0, voe_.AssociateSendChannel(recv_ch, send_ch)); | 3101 EXPECT_EQ(0, voe_.AssociateSendChannel(recv_ch, send_ch)); |
| 3204 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), send_ch); | 3102 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), send_ch); |
| 3205 | 3103 |
| 3206 EXPECT_TRUE(channel_->RemoveSendStream(2)); | 3104 EXPECT_TRUE(channel_->RemoveSendStream(2)); |
| 3207 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), -1); | 3105 EXPECT_EQ(voe_.GetAssociateSendChannel(recv_ch), -1); |
| 3208 } | 3106 } |
| 3209 | 3107 |
| 3210 // Tests for the actual WebRtc VoE library. | |
| 3211 | |
| 3212 TEST(WebRtcVoiceEngineTest, TestDefaultOptionsBeforeInit) { | |
| 3213 cricket::WebRtcVoiceEngine engine; | |
| 3214 cricket::AudioOptions options = engine.GetOptions(); | |
| 3215 // The default options should have at least a few things set. We purposefully | |
| 3216 // don't check the option values here, though. | |
| 3217 EXPECT_TRUE(options.echo_cancellation); | |
| 3218 EXPECT_TRUE(options.auto_gain_control); | |
| 3219 EXPECT_TRUE(options.noise_suppression); | |
| 3220 } | |
| 3221 | |
| 3222 // Tests that the library initializes and shuts down properly. | 3108 // Tests that the library initializes and shuts down properly. |
| 3223 TEST(WebRtcVoiceEngineTest, StartupShutdown) { | 3109 TEST(WebRtcVoiceEngineTest, StartupShutdown) { |
| 3224 cricket::WebRtcVoiceEngine engine; | 3110 cricket::WebRtcVoiceEngine engine; |
| 3225 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3111 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
| 3226 rtc::scoped_ptr<webrtc::Call> call( | 3112 rtc::scoped_ptr<webrtc::Call> call( |
| 3227 webrtc::Call::Create(webrtc::Call::Config())); | 3113 webrtc::Call::Create(webrtc::Call::Config())); |
| 3228 cricket::VoiceMediaChannel* channel = | 3114 cricket::VoiceMediaChannel* channel = |
| 3229 engine.CreateChannel(call.get(), cricket::AudioOptions()); | 3115 engine.CreateChannel(call.get(), cricket::AudioOptions()); |
| 3230 EXPECT_TRUE(channel != nullptr); | 3116 EXPECT_TRUE(channel != nullptr); |
| 3231 delete channel; | 3117 delete channel; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3352 cricket::WebRtcVoiceEngine engine; | 3238 cricket::WebRtcVoiceEngine engine; |
| 3353 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3239 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
| 3354 rtc::scoped_ptr<webrtc::Call> call( | 3240 rtc::scoped_ptr<webrtc::Call> call( |
| 3355 webrtc::Call::Create(webrtc::Call::Config())); | 3241 webrtc::Call::Create(webrtc::Call::Config())); |
| 3356 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), | 3242 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), |
| 3357 call.get()); | 3243 call.get()); |
| 3358 cricket::AudioRecvParameters parameters; | 3244 cricket::AudioRecvParameters parameters; |
| 3359 parameters.codecs = engine.codecs(); | 3245 parameters.codecs = engine.codecs(); |
| 3360 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3246 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
| 3361 } | 3247 } |
| OLD | NEW |