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 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 webrtc::AgcConfig config = {0}; | 2985 webrtc::AgcConfig config = {0}; |
2986 EXPECT_EQ(0, voe_.GetAgcConfig(config)); | 2986 EXPECT_EQ(0, voe_.GetAgcConfig(config)); |
2987 EXPECT_EQ(set_config.targetLeveldBOv, config.targetLeveldBOv); | 2987 EXPECT_EQ(set_config.targetLeveldBOv, config.targetLeveldBOv); |
2988 EXPECT_EQ(set_config.digitalCompressionGaindB, | 2988 EXPECT_EQ(set_config.digitalCompressionGaindB, |
2989 config.digitalCompressionGaindB); | 2989 config.digitalCompressionGaindB); |
2990 EXPECT_EQ(set_config.limiterEnable, config.limiterEnable); | 2990 EXPECT_EQ(set_config.limiterEnable, config.limiterEnable); |
2991 } | 2991 } |
2992 | 2992 |
2993 TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) { | 2993 TEST_F(WebRtcVoiceEngineTestFake, SetOptionOverridesViaChannels) { |
2994 EXPECT_TRUE(SetupEngine()); | 2994 EXPECT_TRUE(SetupEngine()); |
2995 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel1( | 2995 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel1( |
2996 engine_.CreateChannel(cricket::AudioOptions())); | 2996 static_cast<cricket::WebRtcVoiceMediaChannel*>( |
2997 rtc::scoped_ptr<cricket::VoiceMediaChannel> channel2( | 2997 engine_.CreateChannel(cricket::AudioOptions()))); |
2998 engine_.CreateChannel(cricket::AudioOptions())); | 2998 rtc::scoped_ptr<cricket::WebRtcVoiceMediaChannel> channel2( |
| 2999 static_cast<cricket::WebRtcVoiceMediaChannel*>( |
| 3000 engine_.CreateChannel(cricket::AudioOptions()))); |
2999 | 3001 |
3000 // Have to add a stream to make SetSend work. | 3002 // Have to add a stream to make SetSend work. |
3001 cricket::StreamParams stream1; | 3003 cricket::StreamParams stream1; |
3002 stream1.ssrcs.push_back(1); | 3004 stream1.ssrcs.push_back(1); |
3003 channel1->AddSendStream(stream1); | 3005 channel1->AddSendStream(stream1); |
3004 cricket::StreamParams stream2; | 3006 cricket::StreamParams stream2; |
3005 stream2.ssrcs.push_back(2); | 3007 stream2.ssrcs.push_back(2); |
3006 channel2->AddSendStream(stream2); | 3008 channel2->AddSendStream(stream2); |
3007 | 3009 |
3008 // AEC and AGC and NS | 3010 // AEC and AGC and NS |
3009 cricket::AudioOptions options_all; | 3011 cricket::AudioOptions options_all; |
3010 options_all.echo_cancellation.Set(true); | 3012 options_all.echo_cancellation.Set(true); |
3011 options_all.auto_gain_control.Set(true); | 3013 options_all.auto_gain_control.Set(true); |
3012 options_all.noise_suppression.Set(true); | 3014 options_all.noise_suppression.Set(true); |
3013 | 3015 |
3014 ASSERT_TRUE(channel1->SetOptions(options_all)); | 3016 ASSERT_TRUE(channel1->SetOptions(options_all)); |
3015 cricket::AudioOptions expected_options = options_all; | 3017 cricket::AudioOptions expected_options = options_all; |
3016 cricket::AudioOptions actual_options; | 3018 EXPECT_EQ(expected_options, channel1->options()); |
3017 ASSERT_TRUE(channel1->GetOptions(&actual_options)); | |
3018 EXPECT_EQ(expected_options, actual_options); | |
3019 ASSERT_TRUE(channel2->SetOptions(options_all)); | 3019 ASSERT_TRUE(channel2->SetOptions(options_all)); |
3020 ASSERT_TRUE(channel2->GetOptions(&actual_options)); | 3020 EXPECT_EQ(expected_options, channel2->options()); |
3021 EXPECT_EQ(expected_options, actual_options); | |
3022 | 3021 |
3023 // unset NS | 3022 // unset NS |
3024 cricket::AudioOptions options_no_ns; | 3023 cricket::AudioOptions options_no_ns; |
3025 options_no_ns.noise_suppression.Set(false); | 3024 options_no_ns.noise_suppression.Set(false); |
3026 ASSERT_TRUE(channel1->SetOptions(options_no_ns)); | 3025 ASSERT_TRUE(channel1->SetOptions(options_no_ns)); |
3027 | 3026 |
3028 expected_options.echo_cancellation.Set(true); | 3027 expected_options.echo_cancellation.Set(true); |
3029 expected_options.auto_gain_control.Set(true); | 3028 expected_options.auto_gain_control.Set(true); |
3030 expected_options.noise_suppression.Set(false); | 3029 expected_options.noise_suppression.Set(false); |
3031 ASSERT_TRUE(channel1->GetOptions(&actual_options)); | 3030 EXPECT_EQ(expected_options, channel1->options()); |
3032 EXPECT_EQ(expected_options, actual_options); | |
3033 | 3031 |
3034 // unset AGC | 3032 // unset AGC |
3035 cricket::AudioOptions options_no_agc; | 3033 cricket::AudioOptions options_no_agc; |
3036 options_no_agc.auto_gain_control.Set(false); | 3034 options_no_agc.auto_gain_control.Set(false); |
3037 ASSERT_TRUE(channel2->SetOptions(options_no_agc)); | 3035 ASSERT_TRUE(channel2->SetOptions(options_no_agc)); |
3038 | 3036 |
3039 expected_options.echo_cancellation.Set(true); | 3037 expected_options.echo_cancellation.Set(true); |
3040 expected_options.auto_gain_control.Set(false); | 3038 expected_options.auto_gain_control.Set(false); |
3041 expected_options.noise_suppression.Set(true); | 3039 expected_options.noise_suppression.Set(true); |
3042 ASSERT_TRUE(channel2->GetOptions(&actual_options)); | 3040 EXPECT_EQ(expected_options, channel2->options()); |
3043 EXPECT_EQ(expected_options, actual_options); | |
3044 | 3041 |
3045 ASSERT_TRUE(engine_.SetOptions(options_all)); | 3042 ASSERT_TRUE(engine_.SetOptions(options_all)); |
3046 bool ec_enabled; | 3043 bool ec_enabled; |
3047 webrtc::EcModes ec_mode; | 3044 webrtc::EcModes ec_mode; |
3048 bool agc_enabled; | 3045 bool agc_enabled; |
3049 webrtc::AgcModes agc_mode; | 3046 webrtc::AgcModes agc_mode; |
3050 bool ns_enabled; | 3047 bool ns_enabled; |
3051 webrtc::NsModes ns_mode; | 3048 webrtc::NsModes ns_mode; |
3052 voe_.GetEcStatus(ec_enabled, ec_mode); | 3049 voe_.GetEcStatus(ec_enabled, ec_mode); |
3053 voe_.GetAgcStatus(agc_enabled, agc_mode); | 3050 voe_.GetAgcStatus(agc_enabled, agc_mode); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 ASSERT_TRUE(engine_.SetOptions(options_all)); | 3089 ASSERT_TRUE(engine_.SetOptions(options_all)); |
3093 cricket::AudioOptions options_no_agc_nor_ns; | 3090 cricket::AudioOptions options_no_agc_nor_ns; |
3094 options_no_agc_nor_ns.auto_gain_control.Set(false); | 3091 options_no_agc_nor_ns.auto_gain_control.Set(false); |
3095 options_no_agc_nor_ns.noise_suppression.Set(false); | 3092 options_no_agc_nor_ns.noise_suppression.Set(false); |
3096 channel2->SetSend(cricket::SEND_MICROPHONE); | 3093 channel2->SetSend(cricket::SEND_MICROPHONE); |
3097 channel2->SetOptions(options_no_agc_nor_ns); | 3094 channel2->SetOptions(options_no_agc_nor_ns); |
3098 | 3095 |
3099 expected_options.echo_cancellation.Set(true); | 3096 expected_options.echo_cancellation.Set(true); |
3100 expected_options.auto_gain_control.Set(false); | 3097 expected_options.auto_gain_control.Set(false); |
3101 expected_options.noise_suppression.Set(false); | 3098 expected_options.noise_suppression.Set(false); |
3102 ASSERT_TRUE(channel2->GetOptions(&actual_options)); | 3099 EXPECT_EQ(expected_options, channel2->options()); |
3103 EXPECT_EQ(expected_options, actual_options); | |
3104 voe_.GetEcStatus(ec_enabled, ec_mode); | 3100 voe_.GetEcStatus(ec_enabled, ec_mode); |
3105 voe_.GetAgcStatus(agc_enabled, agc_mode); | 3101 voe_.GetAgcStatus(agc_enabled, agc_mode); |
3106 voe_.GetNsStatus(ns_enabled, ns_mode); | 3102 voe_.GetNsStatus(ns_enabled, ns_mode); |
3107 EXPECT_TRUE(ec_enabled); | 3103 EXPECT_TRUE(ec_enabled); |
3108 EXPECT_FALSE(agc_enabled); | 3104 EXPECT_FALSE(agc_enabled); |
3109 EXPECT_FALSE(ns_enabled); | 3105 EXPECT_FALSE(ns_enabled); |
3110 } | 3106 } |
3111 | 3107 |
3112 // This test verifies DSCP settings are properly applied on voice media channel. | 3108 // This test verifies DSCP settings are properly applied on voice media channel. |
3113 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { | 3109 TEST_F(WebRtcVoiceEngineTestFake, TestSetDscpOptions) { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3628 engine.Terminate(); | 3624 engine.Terminate(); |
3629 } | 3625 } |
3630 | 3626 |
3631 // Test that we set our preferred codecs properly. | 3627 // Test that we set our preferred codecs properly. |
3632 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { | 3628 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { |
3633 cricket::WebRtcVoiceEngine engine; | 3629 cricket::WebRtcVoiceEngine engine; |
3634 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3630 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3635 cricket::WebRtcVoiceMediaChannel channel(&engine); | 3631 cricket::WebRtcVoiceMediaChannel channel(&engine); |
3636 EXPECT_TRUE(channel.SetRecvCodecs(engine.codecs())); | 3632 EXPECT_TRUE(channel.SetRecvCodecs(engine.codecs())); |
3637 } | 3633 } |
OLD | NEW |