From 07052a8af372cffdb5125cd700f4b0cf3a14c90b Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Wed, 17 Oct 2018 21:58:31 +0000 Subject: [PATCH] Create answers with a=mid even if the offer did not have a=mid Bug 1495569 - Part 0: web-platform-test that verifies handling of offer without mid. Bug 1495569 - Part 1: Ensure that answers are created with the transceiver's mid when the offer did not have a mid. Differential Revision: https://phabricator.services.mozilla.com/D8853 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1495569 gecko-commit: 19b1ad6ceade3ce4ce42e9b4dd793f03e5e81be9 gecko-integration-branch: autoland gecko-reviewers: mid, mid, mjf, jib --- webrtc/RTCRtpTransceiver.https.html | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/webrtc/RTCRtpTransceiver.https.html b/webrtc/RTCRtpTransceiver.https.html index f3b67632f2da94..c638e64b8ba398 100644 --- a/webrtc/RTCRtpTransceiver.https.html +++ b/webrtc/RTCRtpTransceiver.https.html @@ -506,6 +506,40 @@ hasProps(pc.getTransceivers(), []); }; + const checkNoMidOffer = async t => { + const pc1 = new RTCPeerConnection(); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + t.add_cleanup(() => pc2.close()); + + const stream = await navigator.mediaDevices.getUserMedia({audio: true}); + t.add_cleanup(() => stopTracks(stream)); + const track = stream.getAudioTracks()[0]; + pc1.addTrack(track, stream); + + const offer = await pc1.createOffer(); + await pc1.setLocalDescription(offer); + + // Remove mid attr + offer.sdp = offer.sdp.replace("a=mid:", "a=unknownattr:"); + await pc2.setRemoteDescription(offer); + + hasPropsAndUniqueMids(pc2.getTransceivers(), + [ + { + receiver: {track: {kind: "audio"}}, + sender: {track: null}, + direction: "recvonly", + currentDirection: null, + stopped: false + } + ]); + + const answer = await pc2.createAnswer(); + await pc2.setLocalDescription(answer); + await pc1.setRemoteDescription(answer); + }; + const checkAddTransceiverNoTrackDoesntPair = async t => { const pc1 = new RTCPeerConnection(); const pc2 = new RTCPeerConnection(); @@ -2212,6 +2246,7 @@ checkAddTransceiverWithSetRemoteOfferSending, checkAddTransceiverWithSetRemoteOfferNoSend, checkAddTransceiverBadKind, + checkNoMidOffer, checkSetDirection, checkCurrentDirection, checkSendrecvWithNoSendTrack,