diff --git a/webrtc/pc/peerconnection_integrationtest.cc b/webrtc/pc/peerconnection_integrationtest.cc index d20e2f965b..6b3ddd55bf 100644 --- a/webrtc/pc/peerconnection_integrationtest.cc +++ b/webrtc/pc/peerconnection_integrationtest.cc @@ -1393,8 +1393,7 @@ TEST_F(PeerConnectionIntegrationTest, AudioToVideoUpgrade) { // Initially, offer an audio/video stream from the caller, but refuse to // send/receive video on the callee side. caller()->AddAudioVideoMediaStream(); - callee()->AddMediaStreamFromTracks(callee()->CreateLocalAudioTrack(), - nullptr); + callee()->AddAudioOnlyMediaStream(); PeerConnectionInterface::RTCOfferAnswerOptions options; options.offer_to_receive_video = 0; callee()->SetOfferAnswerOptions(options); @@ -1425,6 +1424,30 @@ TEST_F(PeerConnectionIntegrationTest, AudioToVideoUpgrade) { kMaxWaitForFramesMs); } +// Simpler than the above test; just add an audio track to an established +// video-only connection. +TEST_F(PeerConnectionIntegrationTest, AddAudioToVideoOnlyCall) { + ASSERT_TRUE(CreatePeerConnectionWrappers()); + ConnectFakeSignaling(); + // Do initial offer/answer with just a video track. + caller()->AddVideoOnlyMediaStream(); + callee()->AddVideoOnlyMediaStream(); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + // Now add an audio track and do another offer/answer. + caller()->AddMediaStreamFromTracksWithLabel(caller()->CreateLocalAudioTrack(), + nullptr, "audio_stream"); + callee()->AddMediaStreamFromTracksWithLabel(callee()->CreateLocalAudioTrack(), + nullptr, "audio_stream"); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + // Ensure both audio and video frames are received end-to-end. + ExpectNewFramesReceivedWithWait( + kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, + kDefaultExpectedAudioFrameCount, kDefaultExpectedVideoFrameCount, + kMaxWaitForFramesMs); +} + // This test sets up a call that's transferred to a new caller with a different // DTLS fingerprint. TEST_F(PeerConnectionIntegrationTest, CallTransferredForCallee) {