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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 const webrtc::AudioSendStream::Config& GetSendStreamConfig(uint32_t ssrc) { | 159 const webrtc::AudioSendStream::Config& GetSendStreamConfig(uint32_t ssrc) { |
160 return GetSendStream(ssrc).GetConfig(); | 160 return GetSendStream(ssrc).GetConfig(); |
161 } | 161 } |
162 | 162 |
163 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) { | 163 const webrtc::AudioReceiveStream::Config& GetRecvStreamConfig(uint32_t ssrc) { |
164 return GetRecvStream(ssrc).GetConfig(); | 164 return GetRecvStream(ssrc).GetConfig(); |
165 } | 165 } |
166 | 166 |
| 167 void SetSend(cricket::VoiceMediaChannel* channel, bool enable) { |
| 168 ASSERT_TRUE(channel); |
| 169 if (enable) { |
| 170 EXPECT_CALL(adm_, RecordingIsInitialized()).WillOnce(Return(false)); |
| 171 EXPECT_CALL(adm_, Recording()).WillOnce(Return(false)); |
| 172 EXPECT_CALL(adm_, InitRecording()).WillOnce(Return(0)); |
| 173 } |
| 174 channel->SetSend(enable); |
| 175 } |
| 176 |
167 void TestInsertDtmf(uint32_t ssrc, bool caller) { | 177 void TestInsertDtmf(uint32_t ssrc, bool caller) { |
168 EXPECT_TRUE(SetupChannel()); | 178 EXPECT_TRUE(SetupChannel()); |
169 if (caller) { | 179 if (caller) { |
170 // If this is a caller, local description will be applied and add the | 180 // If this is a caller, local description will be applied and add the |
171 // send stream. | 181 // send stream. |
172 EXPECT_TRUE(channel_->AddSendStream( | 182 EXPECT_TRUE(channel_->AddSendStream( |
173 cricket::StreamParams::CreateLegacy(kSsrc1))); | 183 cricket::StreamParams::CreateLegacy(kSsrc1))); |
174 } | 184 } |
175 | 185 |
176 // Test we can only InsertDtmf when the other side supports telephone-event. | 186 // Test we can only InsertDtmf when the other side supports telephone-event. |
177 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 187 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
178 channel_->SetSend(true); | 188 SetSend(channel_, true); |
179 EXPECT_FALSE(channel_->CanInsertDtmf()); | 189 EXPECT_FALSE(channel_->CanInsertDtmf()); |
180 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 1, 111)); | 190 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 1, 111)); |
181 send_parameters_.codecs.push_back(kTelephoneEventCodec); | 191 send_parameters_.codecs.push_back(kTelephoneEventCodec); |
182 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 192 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
183 EXPECT_TRUE(channel_->CanInsertDtmf()); | 193 EXPECT_TRUE(channel_->CanInsertDtmf()); |
184 | 194 |
185 if (!caller) { | 195 if (!caller) { |
186 // If this is callee, there's no active send channel yet. | 196 // If this is callee, there's no active send channel yet. |
187 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 2, 123)); | 197 EXPECT_FALSE(channel_->InsertDtmf(ssrc, 2, 123)); |
188 EXPECT_TRUE(channel_->AddSendStream( | 198 EXPECT_TRUE(channel_->AddSendStream( |
(...skipping 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension); | 2157 TestSetSendRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension); |
2148 } | 2158 } |
2149 TEST_F(WebRtcVoiceEngineTestFake, RecvAbsoluteSendTimeHeaderExtensions) { | 2159 TEST_F(WebRtcVoiceEngineTestFake, RecvAbsoluteSendTimeHeaderExtensions) { |
2150 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension); | 2160 TestSetRecvRtpHeaderExtensions(kRtpAbsoluteSenderTimeHeaderExtension); |
2151 } | 2161 } |
2152 | 2162 |
2153 // Test that we can create a channel and start sending on it. | 2163 // Test that we can create a channel and start sending on it. |
2154 TEST_F(WebRtcVoiceEngineTestFake, Send) { | 2164 TEST_F(WebRtcVoiceEngineTestFake, Send) { |
2155 EXPECT_TRUE(SetupSendStream()); | 2165 EXPECT_TRUE(SetupSendStream()); |
2156 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2166 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2157 channel_->SetSend(true); | 2167 SetSend(channel_, true); |
2158 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); | 2168 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); |
2159 channel_->SetSend(false); | 2169 SetSend(channel_, false); |
2160 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2170 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2161 } | 2171 } |
2162 | 2172 |
2163 // Test that a channel will send if and only if it has a source and is enabled | 2173 // Test that a channel will send if and only if it has a source and is enabled |
2164 // for sending. | 2174 // for sending. |
2165 TEST_F(WebRtcVoiceEngineTestFake, SendStateWithAndWithoutSource) { | 2175 TEST_F(WebRtcVoiceEngineTestFake, SendStateWithAndWithoutSource) { |
2166 EXPECT_TRUE(SetupSendStream()); | 2176 EXPECT_TRUE(SetupSendStream()); |
2167 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2177 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2168 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); | 2178 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); |
2169 channel_->SetSend(true); | 2179 SetSend(channel_, true); |
2170 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2180 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2171 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, &fake_source_)); | 2181 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, &fake_source_)); |
2172 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); | 2182 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); |
2173 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); | 2183 EXPECT_TRUE(channel_->SetAudioSend(kSsrc1, true, nullptr, nullptr)); |
2174 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2184 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2175 } | 2185 } |
2176 | 2186 |
2177 // Test that SetSendParameters() does not alter a stream's send state. | 2187 // Test that SetSendParameters() does not alter a stream's send state. |
2178 TEST_F(WebRtcVoiceEngineTestFake, SendStateWhenStreamsAreRecreated) { | 2188 TEST_F(WebRtcVoiceEngineTestFake, SendStateWhenStreamsAreRecreated) { |
2179 EXPECT_TRUE(SetupSendStream()); | 2189 EXPECT_TRUE(SetupSendStream()); |
2180 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2190 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2181 | 2191 |
2182 // Turn on sending. | 2192 // Turn on sending. |
2183 channel_->SetSend(true); | 2193 SetSend(channel_, true); |
2184 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); | 2194 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); |
2185 | 2195 |
2186 // Changing RTP header extensions will recreate the AudioSendStream. | 2196 // Changing RTP header extensions will recreate the AudioSendStream. |
2187 send_parameters_.extensions.push_back( | 2197 send_parameters_.extensions.push_back( |
2188 cricket::RtpHeaderExtension(kRtpAudioLevelHeaderExtension, 12)); | 2198 cricket::RtpHeaderExtension(kRtpAudioLevelHeaderExtension, 12)); |
2189 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2199 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2190 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); | 2200 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); |
2191 | 2201 |
2192 // Turn off sending. | 2202 // Turn off sending. |
2193 channel_->SetSend(false); | 2203 SetSend(channel_, false); |
2194 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2204 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2195 | 2205 |
2196 // Changing RTP header extensions will recreate the AudioSendStream. | 2206 // Changing RTP header extensions will recreate the AudioSendStream. |
2197 send_parameters_.extensions.clear(); | 2207 send_parameters_.extensions.clear(); |
2198 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2208 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2199 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2209 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2200 } | 2210 } |
2201 | 2211 |
2202 // Test that we can create a channel and start playing out on it. | 2212 // Test that we can create a channel and start playing out on it. |
2203 TEST_F(WebRtcVoiceEngineTestFake, Playout) { | 2213 TEST_F(WebRtcVoiceEngineTestFake, Playout) { |
2204 EXPECT_TRUE(SetupRecvStream()); | 2214 EXPECT_TRUE(SetupRecvStream()); |
2205 int channel_num = voe_.GetLastChannel(); | 2215 int channel_num = voe_.GetLastChannel(); |
2206 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); | 2216 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); |
2207 EXPECT_TRUE(channel_->SetPlayout(true)); | 2217 EXPECT_TRUE(channel_->SetPlayout(true)); |
2208 EXPECT_TRUE(voe_.GetPlayout(channel_num)); | 2218 EXPECT_TRUE(voe_.GetPlayout(channel_num)); |
2209 EXPECT_TRUE(channel_->SetPlayout(false)); | 2219 EXPECT_TRUE(channel_->SetPlayout(false)); |
2210 EXPECT_FALSE(voe_.GetPlayout(channel_num)); | 2220 EXPECT_FALSE(voe_.GetPlayout(channel_num)); |
2211 } | 2221 } |
2212 | 2222 |
2213 // Test that we can add and remove send streams. | 2223 // Test that we can add and remove send streams. |
2214 TEST_F(WebRtcVoiceEngineTestFake, CreateAndDeleteMultipleSendStreams) { | 2224 TEST_F(WebRtcVoiceEngineTestFake, CreateAndDeleteMultipleSendStreams) { |
2215 SetupForMultiSendStream(); | 2225 SetupForMultiSendStream(); |
2216 | 2226 |
2217 // Set the global state for sending. | 2227 // Set the global state for sending. |
2218 channel_->SetSend(true); | 2228 SetSend(channel_, true); |
2219 | 2229 |
2220 for (uint32_t ssrc : kSsrcs4) { | 2230 for (uint32_t ssrc : kSsrcs4) { |
2221 EXPECT_TRUE(channel_->AddSendStream( | 2231 EXPECT_TRUE(channel_->AddSendStream( |
2222 cricket::StreamParams::CreateLegacy(ssrc))); | 2232 cricket::StreamParams::CreateLegacy(ssrc))); |
2223 EXPECT_TRUE(channel_->SetAudioSend(ssrc, true, nullptr, &fake_source_)); | 2233 EXPECT_TRUE(channel_->SetAudioSend(ssrc, true, nullptr, &fake_source_)); |
2224 // Verify that we are in a sending state for all the created streams. | 2234 // Verify that we are in a sending state for all the created streams. |
2225 EXPECT_TRUE(GetSendStream(ssrc).IsSending()); | 2235 EXPECT_TRUE(GetSendStream(ssrc).IsSending()); |
2226 } | 2236 } |
2227 EXPECT_EQ(arraysize(kSsrcs4), call_.GetAudioSendStreams().size()); | 2237 EXPECT_EQ(arraysize(kSsrcs4), call_.GetAudioSendStreams().size()); |
2228 | 2238 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 | 2289 |
2280 // Create the send channels and they should be a "not sending" date. | 2290 // Create the send channels and they should be a "not sending" date. |
2281 for (uint32_t ssrc : kSsrcs4) { | 2291 for (uint32_t ssrc : kSsrcs4) { |
2282 EXPECT_TRUE(channel_->AddSendStream( | 2292 EXPECT_TRUE(channel_->AddSendStream( |
2283 cricket::StreamParams::CreateLegacy(ssrc))); | 2293 cricket::StreamParams::CreateLegacy(ssrc))); |
2284 EXPECT_TRUE(channel_->SetAudioSend(ssrc, true, nullptr, &fake_source_)); | 2294 EXPECT_TRUE(channel_->SetAudioSend(ssrc, true, nullptr, &fake_source_)); |
2285 EXPECT_FALSE(GetSendStream(ssrc).IsSending()); | 2295 EXPECT_FALSE(GetSendStream(ssrc).IsSending()); |
2286 } | 2296 } |
2287 | 2297 |
2288 // Set the global state for starting sending. | 2298 // Set the global state for starting sending. |
2289 channel_->SetSend(true); | 2299 SetSend(channel_, true); |
2290 for (uint32_t ssrc : kSsrcs4) { | 2300 for (uint32_t ssrc : kSsrcs4) { |
2291 // Verify that we are in a sending state for all the send streams. | 2301 // Verify that we are in a sending state for all the send streams. |
2292 EXPECT_TRUE(GetSendStream(ssrc).IsSending()); | 2302 EXPECT_TRUE(GetSendStream(ssrc).IsSending()); |
2293 } | 2303 } |
2294 | 2304 |
2295 // Set the global state for stopping sending. | 2305 // Set the global state for stopping sending. |
2296 channel_->SetSend(false); | 2306 SetSend(channel_, false); |
2297 for (uint32_t ssrc : kSsrcs4) { | 2307 for (uint32_t ssrc : kSsrcs4) { |
2298 // Verify that we are in a stop state for all the send streams. | 2308 // Verify that we are in a stop state for all the send streams. |
2299 EXPECT_FALSE(GetSendStream(ssrc).IsSending()); | 2309 EXPECT_FALSE(GetSendStream(ssrc).IsSending()); |
2300 } | 2310 } |
2301 } | 2311 } |
2302 | 2312 |
2303 // Test we can set the correct statistics on all send streams. | 2313 // Test we can set the correct statistics on all send streams. |
2304 TEST_F(WebRtcVoiceEngineTestFake, GetStatsWithMultipleSendStreams) { | 2314 TEST_F(WebRtcVoiceEngineTestFake, GetStatsWithMultipleSendStreams) { |
2305 SetupForMultiSendStream(); | 2315 SetupForMultiSendStream(); |
2306 | 2316 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2365 | 2375 |
2366 // Start playout without a receive stream. | 2376 // Start playout without a receive stream. |
2367 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2377 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2368 EXPECT_TRUE(channel_->SetPlayout(true)); | 2378 EXPECT_TRUE(channel_->SetPlayout(true)); |
2369 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); | 2379 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); |
2370 | 2380 |
2371 // Adding another stream should enable playout on the new stream only. | 2381 // Adding another stream should enable playout on the new stream only. |
2372 EXPECT_TRUE( | 2382 EXPECT_TRUE( |
2373 channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc2))); | 2383 channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc2))); |
2374 int channel_num2 = voe_.GetLastChannel(); | 2384 int channel_num2 = voe_.GetLastChannel(); |
2375 channel_->SetSend(true); | 2385 SetSend(channel_, true); |
2376 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); | 2386 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); |
2377 | 2387 |
2378 // Make sure only the new stream is played out. | 2388 // Make sure only the new stream is played out. |
2379 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); | 2389 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); |
2380 EXPECT_TRUE(voe_.GetPlayout(channel_num2)); | 2390 EXPECT_TRUE(voe_.GetPlayout(channel_num2)); |
2381 | 2391 |
2382 // Adding yet another stream should have stream 2 and 3 enabled for playout. | 2392 // Adding yet another stream should have stream 2 and 3 enabled for playout. |
2383 EXPECT_TRUE( | 2393 EXPECT_TRUE( |
2384 channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc3))); | 2394 channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc3))); |
2385 int channel_num3 = voe_.GetLastChannel(); | 2395 int channel_num3 = voe_.GetLastChannel(); |
2386 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); | 2396 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); |
2387 EXPECT_TRUE(voe_.GetPlayout(channel_num2)); | 2397 EXPECT_TRUE(voe_.GetPlayout(channel_num2)); |
2388 EXPECT_TRUE(voe_.GetPlayout(channel_num3)); | 2398 EXPECT_TRUE(voe_.GetPlayout(channel_num3)); |
2389 | 2399 |
2390 // Stop sending. | 2400 // Stop sending. |
2391 channel_->SetSend(false); | 2401 SetSend(channel_, false); |
2392 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2402 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2393 | 2403 |
2394 // Stop playout. | 2404 // Stop playout. |
2395 EXPECT_TRUE(channel_->SetPlayout(false)); | 2405 EXPECT_TRUE(channel_->SetPlayout(false)); |
2396 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); | 2406 EXPECT_FALSE(voe_.GetPlayout(channel_num1)); |
2397 EXPECT_FALSE(voe_.GetPlayout(channel_num2)); | 2407 EXPECT_FALSE(voe_.GetPlayout(channel_num2)); |
2398 EXPECT_FALSE(voe_.GetPlayout(channel_num3)); | 2408 EXPECT_FALSE(voe_.GetPlayout(channel_num3)); |
2399 | 2409 |
2400 // Restart playout and make sure only recv streams are played out. | 2410 // Restart playout and make sure only recv streams are played out. |
2401 EXPECT_TRUE(channel_->SetPlayout(true)); | 2411 EXPECT_TRUE(channel_->SetPlayout(true)); |
(...skipping 11 matching lines...) Expand all Loading... |
2413 // and start sending on it. | 2423 // and start sending on it. |
2414 TEST_F(WebRtcVoiceEngineTestFake, CodianSend) { | 2424 TEST_F(WebRtcVoiceEngineTestFake, CodianSend) { |
2415 EXPECT_TRUE(SetupSendStream()); | 2425 EXPECT_TRUE(SetupSendStream()); |
2416 cricket::AudioOptions options_adjust_agc; | 2426 cricket::AudioOptions options_adjust_agc; |
2417 options_adjust_agc.adjust_agc_delta = rtc::Optional<int>(-10); | 2427 options_adjust_agc.adjust_agc_delta = rtc::Optional<int>(-10); |
2418 webrtc::AgcConfig agc_config; | 2428 webrtc::AgcConfig agc_config; |
2419 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2429 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
2420 EXPECT_EQ(0, agc_config.targetLeveldBOv); | 2430 EXPECT_EQ(0, agc_config.targetLeveldBOv); |
2421 send_parameters_.options = options_adjust_agc; | 2431 send_parameters_.options = options_adjust_agc; |
2422 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2432 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2423 channel_->SetSend(true); | 2433 SetSend(channel_, true); |
2424 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); | 2434 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); |
2425 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2435 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
2426 EXPECT_EQ(agc_config.targetLeveldBOv, 10); // level was attenuated | 2436 EXPECT_EQ(agc_config.targetLeveldBOv, 10); // level was attenuated |
2427 channel_->SetSend(false); | 2437 SetSend(channel_, false); |
2428 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); | 2438 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending()); |
2429 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2439 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
2430 } | 2440 } |
2431 | 2441 |
2432 TEST_F(WebRtcVoiceEngineTestFake, TxAgcConfigViaOptions) { | 2442 TEST_F(WebRtcVoiceEngineTestFake, TxAgcConfigViaOptions) { |
2433 EXPECT_TRUE(SetupSendStream()); | 2443 EXPECT_TRUE(SetupSendStream()); |
2434 EXPECT_CALL(adm_, | 2444 EXPECT_CALL(adm_, |
2435 BuiltInAGCIsAvailable()).Times(2).WillRepeatedly(Return(false)); | 2445 BuiltInAGCIsAvailable()).Times(2).WillRepeatedly(Return(false)); |
2436 webrtc::AgcConfig agc_config; | 2446 webrtc::AgcConfig agc_config; |
2437 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); | 2447 EXPECT_EQ(0, voe_.GetAgcConfig(agc_config)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2492 EXPECT_EQ(1u, info.senders.size()); | 2502 EXPECT_EQ(1u, info.senders.size()); |
2493 VerifyVoiceSenderInfo(info.senders[0], false); | 2503 VerifyVoiceSenderInfo(info.senders[0], false); |
2494 // We have added one receive stream. We should see empty stats. | 2504 // We have added one receive stream. We should see empty stats. |
2495 EXPECT_EQ(info.receivers.size(), 1u); | 2505 EXPECT_EQ(info.receivers.size(), 1u); |
2496 EXPECT_EQ(info.receivers[0].ssrc(), 0); | 2506 EXPECT_EQ(info.receivers[0].ssrc(), 0); |
2497 } | 2507 } |
2498 | 2508 |
2499 // Start sending - this affects some reported stats. | 2509 // Start sending - this affects some reported stats. |
2500 { | 2510 { |
2501 cricket::VoiceMediaInfo info; | 2511 cricket::VoiceMediaInfo info; |
2502 channel_->SetSend(true); | 2512 SetSend(channel_, true); |
2503 EXPECT_EQ(true, channel_->GetStats(&info)); | 2513 EXPECT_EQ(true, channel_->GetStats(&info)); |
2504 VerifyVoiceSenderInfo(info.senders[0], true); | 2514 VerifyVoiceSenderInfo(info.senders[0], true); |
2505 } | 2515 } |
2506 | 2516 |
2507 // Remove the kSsrc2 stream. No receiver stats. | 2517 // Remove the kSsrc2 stream. No receiver stats. |
2508 { | 2518 { |
2509 cricket::VoiceMediaInfo info; | 2519 cricket::VoiceMediaInfo info; |
2510 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); | 2520 EXPECT_TRUE(channel_->RemoveRecvStream(kSsrc2)); |
2511 EXPECT_EQ(true, channel_->GetStats(&info)); | 2521 EXPECT_EQ(true, channel_->GetStats(&info)); |
2512 EXPECT_EQ(1u, info.senders.size()); | 2522 EXPECT_EQ(1u, info.senders.size()); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 } | 2758 } |
2749 | 2759 |
2750 // Test the InsertDtmf on specified send stream as callee. | 2760 // Test the InsertDtmf on specified send stream as callee. |
2751 TEST_F(WebRtcVoiceEngineTestFake, InsertDtmfOnSendStreamAsCallee) { | 2761 TEST_F(WebRtcVoiceEngineTestFake, InsertDtmfOnSendStreamAsCallee) { |
2752 TestInsertDtmf(kSsrc1, false); | 2762 TestInsertDtmf(kSsrc1, false); |
2753 } | 2763 } |
2754 | 2764 |
2755 TEST_F(WebRtcVoiceEngineTestFake, TestSetPlayoutError) { | 2765 TEST_F(WebRtcVoiceEngineTestFake, TestSetPlayoutError) { |
2756 EXPECT_TRUE(SetupSendStream()); | 2766 EXPECT_TRUE(SetupSendStream()); |
2757 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 2767 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
2758 channel_->SetSend(true); | 2768 SetSend(channel_, true); |
2759 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2))); | 2769 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(2))); |
2760 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(3))); | 2770 EXPECT_TRUE(channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(3))); |
2761 EXPECT_TRUE(channel_->SetPlayout(true)); | 2771 EXPECT_TRUE(channel_->SetPlayout(true)); |
2762 voe_.set_playout_fail_channel(voe_.GetLastChannel() - 1); | 2772 voe_.set_playout_fail_channel(voe_.GetLastChannel() - 1); |
2763 EXPECT_TRUE(channel_->SetPlayout(false)); | 2773 EXPECT_TRUE(channel_->SetPlayout(false)); |
2764 EXPECT_FALSE(channel_->SetPlayout(true)); | 2774 EXPECT_FALSE(channel_->SetPlayout(true)); |
2765 } | 2775 } |
2766 | 2776 |
2767 TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) { | 2777 TEST_F(WebRtcVoiceEngineTestFake, SetAudioOptions) { |
2768 EXPECT_TRUE(SetupSendStream()); | 2778 EXPECT_TRUE(SetupSendStream()); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3029 webrtc::AgcModes agc_mode; | 3039 webrtc::AgcModes agc_mode; |
3030 bool ns_enabled; | 3040 bool ns_enabled; |
3031 webrtc::NsModes ns_mode; | 3041 webrtc::NsModes ns_mode; |
3032 voe_.GetEcStatus(ec_enabled, ec_mode); | 3042 voe_.GetEcStatus(ec_enabled, ec_mode); |
3033 voe_.GetAgcStatus(agc_enabled, agc_mode); | 3043 voe_.GetAgcStatus(agc_enabled, agc_mode); |
3034 voe_.GetNsStatus(ns_enabled, ns_mode); | 3044 voe_.GetNsStatus(ns_enabled, ns_mode); |
3035 EXPECT_TRUE(ec_enabled); | 3045 EXPECT_TRUE(ec_enabled); |
3036 EXPECT_TRUE(agc_enabled); | 3046 EXPECT_TRUE(agc_enabled); |
3037 EXPECT_TRUE(ns_enabled); | 3047 EXPECT_TRUE(ns_enabled); |
3038 | 3048 |
3039 channel1->SetSend(true); | 3049 SetSend(channel1.get(), true); |
3040 voe_.GetEcStatus(ec_enabled, ec_mode); | 3050 voe_.GetEcStatus(ec_enabled, ec_mode); |
3041 voe_.GetAgcStatus(agc_enabled, agc_mode); | 3051 voe_.GetAgcStatus(agc_enabled, agc_mode); |
3042 voe_.GetNsStatus(ns_enabled, ns_mode); | 3052 voe_.GetNsStatus(ns_enabled, ns_mode); |
3043 EXPECT_TRUE(ec_enabled); | 3053 EXPECT_TRUE(ec_enabled); |
3044 EXPECT_TRUE(agc_enabled); | 3054 EXPECT_TRUE(agc_enabled); |
3045 EXPECT_FALSE(ns_enabled); | 3055 EXPECT_FALSE(ns_enabled); |
3046 | 3056 |
3047 channel2->SetSend(true); | 3057 SetSend(channel2.get(), true); |
3048 voe_.GetEcStatus(ec_enabled, ec_mode); | 3058 voe_.GetEcStatus(ec_enabled, ec_mode); |
3049 voe_.GetAgcStatus(agc_enabled, agc_mode); | 3059 voe_.GetAgcStatus(agc_enabled, agc_mode); |
3050 voe_.GetNsStatus(ns_enabled, ns_mode); | 3060 voe_.GetNsStatus(ns_enabled, ns_mode); |
3051 EXPECT_TRUE(ec_enabled); | 3061 EXPECT_TRUE(ec_enabled); |
3052 EXPECT_FALSE(agc_enabled); | 3062 EXPECT_FALSE(agc_enabled); |
3053 EXPECT_TRUE(ns_enabled); | 3063 EXPECT_TRUE(ns_enabled); |
3054 | 3064 |
3055 // Make sure settings take effect while we are sending. | 3065 // Make sure settings take effect while we are sending. |
3056 ASSERT_TRUE(channel_->SetSendParameters(parameters_options_all)); | 3066 ASSERT_TRUE(channel_->SetSendParameters(parameters_options_all)); |
3057 cricket::AudioSendParameters parameters_options_no_agc_nor_ns = | 3067 cricket::AudioSendParameters parameters_options_no_agc_nor_ns = |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { | 3526 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { |
3517 cricket::WebRtcVoiceEngine engine(nullptr); | 3527 cricket::WebRtcVoiceEngine engine(nullptr); |
3518 std::unique_ptr<webrtc::Call> call( | 3528 std::unique_ptr<webrtc::Call> call( |
3519 webrtc::Call::Create(webrtc::Call::Config())); | 3529 webrtc::Call::Create(webrtc::Call::Config())); |
3520 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3530 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
3521 cricket::AudioOptions(), call.get()); | 3531 cricket::AudioOptions(), call.get()); |
3522 cricket::AudioRecvParameters parameters; | 3532 cricket::AudioRecvParameters parameters; |
3523 parameters.codecs = engine.codecs(); | 3533 parameters.codecs = engine.codecs(); |
3524 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3534 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3525 } | 3535 } |
OLD | NEW |