From 60c8dc8470939fa8cd0ec5414ed805fe01a19606 Mon Sep 17 00:00:00 2001 From: Taylor Brandstetter Date: Wed, 11 Apr 2018 15:20:27 -0700 Subject: [PATCH] Adding regression test for rejecting and un-rejecting an m= section. This was previously not working because the answerer wasn't generating ICE credentials when it should have been. This was fixed inadvertently by: https://webrtc-review.googlesource.com/c/src/+/46380 But we should really also have a PeerConnection-level regression test for this. Bug: webrtc:6023 Change-Id: I3da900edcc8db8034ed61a7bb981d9c0e616254e Reviewed-on: https://webrtc-review.googlesource.com/69403 Commit-Queue: Taylor Brandstetter Reviewed-by: Steve Anton Cr-Commit-Position: refs/heads/master@{#22832} --- pc/peerconnection_integrationtest.cc | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc index b9a0227c76..12492982ca 100644 --- a/pc/peerconnection_integrationtest.cc +++ b/pc/peerconnection_integrationtest.cc @@ -2176,6 +2176,43 @@ TEST_P(PeerConnectionIntegrationTest, VideoRejectedInSubsequentOffer) { } } +// Do one offer/answer with audio, another that disables it (rejecting the m= +// section), and another that re-enables it. Regression test for: +// bugs.webrtc.org/6023 +TEST_F(PeerConnectionIntegrationTestPlanB, EnableAudioAfterRejecting) { + ASSERT_TRUE(CreatePeerConnectionWrappers()); + ConnectFakeSignaling(); + + // Add audio track, do normal offer/answer. + rtc::scoped_refptr track = + caller()->CreateLocalAudioTrack(); + rtc::scoped_refptr sender = + caller()->pc()->AddTrack(track, {"stream"}).MoveValue(); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + + // Remove audio track, and set offer_to_receive_audio to false to cause the + // m= section to be completely disabled, not just "recvonly". + caller()->pc()->RemoveTrack(sender); + PeerConnectionInterface::RTCOfferAnswerOptions options; + options.offer_to_receive_audio = 0; + caller()->SetOfferAnswerOptions(options); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + + // Add the audio track again, expecting negotiation to succeed and frames to + // flow. + sender = caller()->pc()->AddTrack(track, {"stream"}).MoveValue(); + options.offer_to_receive_audio = 1; + caller()->SetOfferAnswerOptions(options); + caller()->CreateAndSetAndSignalOffer(); + ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout); + + MediaExpectations media_expectations; + media_expectations.CalleeExpectsSomeAudio(); + EXPECT_TRUE(ExpectNewFrames(media_expectations)); +} + // Basic end-to-end test, but without SSRC/MSID signaling. This functionality // is needed to support legacy endpoints. // TODO(deadbeef): When we support the MID extension and demuxing on MID, also