[Webkit-unassigned] [Bug 191169] New: Safari rejects offer generated by peerconnection.createOffer()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 1 14:26:56 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=191169

            Bug ID: 191169
           Summary: Safari rejects offer generated by
                    peerconnection.createOffer()
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: macOS 10.14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebRTC
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ibc at aliax.net
                CC: youennf at gmail.com

Adding a transceiver for sending audio, then stopping it, then adding a new transceiver for sending video. During the second SDP O/A, pc.setLocalDescription() fails with "OperationError: Failed to set local offer sdp: The m= section:1 should be rejected."

It's a clear bug when offer produced by pc.createOffer() is later rejected in pc.setLocalDescription(offer).

Below the code to reproduce it. IMPORTANT:

* Safari Tech Preview 12.1.
* "WebRTC Unified-Plan" enabled in menu "Develop / Experimental Features".

Just open the browser console and paste this code:


-------------------------------------------------------------
let micTrack;
let webcamTrack;
let pc;
let micTransceiver;
let webcamTransceiver;

navigator.mediaDevices.getUserMedia({ audio: true, video: true })
  .then((stream) =>
  {
    micTrack = stream.getAudioTracks()[0];
    webcamTrack = stream.getVideoTracks()[0];
  })
  .then(() =>
  {
    pc = new RTCPeerConnection(
      {
        iceServers    : [],
        bundlePolicy  : 'max-bundle',
        rtcpMuxPolicy : 'require',
        sdpSemantics  : 'unified-plan'
      });

    console.warn('pc: adding mic track');

    micTransceiver =
      pc.addTransceiver(micTrack, { direction: 'sendonly' });
  })
  .then(() => doSdpStuff())
  .then(() =>
  {
    console.warn('pc: removing mic track');

    micTrack.stop();

    pc.removeTrack(micTransceiver.sender);

    // NOTE: Chrome does not implement transceive.stop().
    try { micTransceiver.stop(); } catch(error) {}

    // NOTE: Safari 12.1 does not allow setting transceiver.direction.
    try { micTransceiver.direction = 'inactive'; } catch(error) {}
  })
  .then(() =>
  {
    // Add the webcam track to pc.

    console.warn('pc: adding webcam');

    webcamTransceiver =
      pc.addTransceiver(webcamTrack, { direction: 'sendonly' });
  })
  .then(() => doSdpStuff())
  .catch((error) =>
  {
    console.error(error);
  });

function doSdpStuff()
{
  let errored = false;

  return Promise.resolve()
    .then(() => pc.createOffer())
    .catch((error) =>
    {
      console.error('pc.createOffer() failed');

      errored = true;
      throw error;
    })
    .then((offer) =>
    {
      console.warn('pc.createOffer() succeeded:\n%s', offer.sdp);

      return pc.setLocalDescription(offer);
    })
    .catch((error) =>
    {
      if (errored)
        throw error;

      console.error('pc.setLocalDescription() failed');

      throw error;
    })
}
-------------------------------------------------------------

NOTE: This bug does not happen in Chrome.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181101/64ab6336/attachment.html>


More information about the webkit-unassigned mailing list