Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: webrtc/pc/peerconnection_integrationtest.cc

Issue 3007923002: Add a PeerConnection integration test for adding an audio track mid-call (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 1386
1387 // This test sets up a audio call initially, with the callee rejecting video 1387 // This test sets up a audio call initially, with the callee rejecting video
1388 // initially. Then later the callee decides to upgrade to audio/video, and 1388 // initially. Then later the callee decides to upgrade to audio/video, and
1389 // initiates a new offer/answer exchange. 1389 // initiates a new offer/answer exchange.
1390 TEST_F(PeerConnectionIntegrationTest, AudioToVideoUpgrade) { 1390 TEST_F(PeerConnectionIntegrationTest, AudioToVideoUpgrade) {
1391 ASSERT_TRUE(CreatePeerConnectionWrappers()); 1391 ASSERT_TRUE(CreatePeerConnectionWrappers());
1392 ConnectFakeSignaling(); 1392 ConnectFakeSignaling();
1393 // Initially, offer an audio/video stream from the caller, but refuse to 1393 // Initially, offer an audio/video stream from the caller, but refuse to
1394 // send/receive video on the callee side. 1394 // send/receive video on the callee side.
1395 caller()->AddAudioVideoMediaStream(); 1395 caller()->AddAudioVideoMediaStream();
1396 callee()->AddMediaStreamFromTracks(callee()->CreateLocalAudioTrack(), 1396 callee()->AddAudioOnlyMediaStream();
1397 nullptr);
1398 PeerConnectionInterface::RTCOfferAnswerOptions options; 1397 PeerConnectionInterface::RTCOfferAnswerOptions options;
1399 options.offer_to_receive_video = 0; 1398 options.offer_to_receive_video = 0;
1400 callee()->SetOfferAnswerOptions(options); 1399 callee()->SetOfferAnswerOptions(options);
1401 // Do offer/answer and make sure audio is still received end-to-end. 1400 // Do offer/answer and make sure audio is still received end-to-end.
1402 caller()->CreateAndSetAndSignalOffer(); 1401 caller()->CreateAndSetAndSignalOffer();
1403 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); 1402 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
1404 ExpectNewFramesReceivedWithWait(kDefaultExpectedAudioFrameCount, 0, 1403 ExpectNewFramesReceivedWithWait(kDefaultExpectedAudioFrameCount, 0,
1405 kDefaultExpectedAudioFrameCount, 0, 1404 kDefaultExpectedAudioFrameCount, 0,
1406 kMaxWaitForFramesMs); 1405 kMaxWaitForFramesMs);
1407 // Sanity check that the callee's description has a rejected video section. 1406 // Sanity check that the callee's description has a rejected video section.
(...skipping 10 matching lines...) Expand all
1418 callee()->SetOfferAnswerOptions(options); 1417 callee()->SetOfferAnswerOptions(options);
1419 callee()->CreateAndSetAndSignalOffer(); 1418 callee()->CreateAndSetAndSignalOffer();
1420 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); 1419 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
1421 // Expect additional audio frames to be received after the upgrade. 1420 // Expect additional audio frames to be received after the upgrade.
1422 ExpectNewFramesReceivedWithWait( 1421 ExpectNewFramesReceivedWithWait(
1423 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, 1422 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount,
1424 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, 1423 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount,
1425 kMaxWaitForFramesMs); 1424 kMaxWaitForFramesMs);
1426 } 1425 }
1427 1426
1427 // Simpler than the above test; just add an audio track to an established
1428 // video-only connection.
1429 TEST_F(PeerConnectionIntegrationTest, AddAudioToVideoOnlyCall) {
1430 ASSERT_TRUE(CreatePeerConnectionWrappers());
1431 ConnectFakeSignaling();
1432 // Do initial offer/answer with just a video track.
1433 caller()->AddVideoOnlyMediaStream();
1434 callee()->AddVideoOnlyMediaStream();
1435 caller()->CreateAndSetAndSignalOffer();
1436 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
1437 // Now add an audio track and do another offer/answer.
1438 caller()->AddMediaStreamFromTracksWithLabel(caller()->CreateLocalAudioTrack(),
1439 nullptr, "audio_stream");
1440 callee()->AddMediaStreamFromTracksWithLabel(callee()->CreateLocalAudioTrack(),
1441 nullptr, "audio_stream");
1442 caller()->CreateAndSetAndSignalOffer();
1443 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
1444 // Ensure both audio and video frames are received end-to-end.
1445 ExpectNewFramesReceivedWithWait(
1446 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount,
1447 kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount,
1448 kMaxWaitForFramesMs);
1449 }
1450
1428 // This test sets up a call that's transferred to a new caller with a different 1451 // This test sets up a call that's transferred to a new caller with a different
1429 // DTLS fingerprint. 1452 // DTLS fingerprint.
1430 TEST_F(PeerConnectionIntegrationTest, CallTransferredForCallee) { 1453 TEST_F(PeerConnectionIntegrationTest, CallTransferredForCallee) {
1431 ASSERT_TRUE(CreatePeerConnectionWrappers()); 1454 ASSERT_TRUE(CreatePeerConnectionWrappers());
1432 ConnectFakeSignaling(); 1455 ConnectFakeSignaling();
1433 caller()->AddAudioVideoMediaStream(); 1456 caller()->AddAudioVideoMediaStream();
1434 callee()->AddAudioVideoMediaStream(); 1457 callee()->AddAudioVideoMediaStream();
1435 caller()->CreateAndSetAndSignalOffer(); 1458 caller()->CreateAndSetAndSignalOffer();
1436 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); 1459 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
1437 1460
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 caller()->CreateAndSetAndSignalOffer(); 2993 caller()->CreateAndSetAndSignalOffer();
2971 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); 2994 ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
2972 // Wait for additional audio frames to be received by the callee. 2995 // Wait for additional audio frames to be received by the callee.
2973 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0, 2996 ExpectNewFramesReceivedWithWait(0, 0, kDefaultExpectedAudioFrameCount, 0,
2974 kMaxWaitForFramesMs); 2997 kMaxWaitForFramesMs);
2975 } 2998 }
2976 2999
2977 } // namespace 3000 } // namespace
2978 3001
2979 #endif // if !defined(THREAD_SANITIZER) 3002 #endif // if !defined(THREAD_SANITIZER)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698