Bug 190960 - [WebRTC] Setting remote answer fails in first m-line was rejected
Summary: [WebRTC] Setting remote answer fails in first m-line was rejected
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-26 07:28 PDT by Lorenzo Miniero
Modified: 2018-10-26 18:36 PDT (History)
2 users (show)

See Also:


Attachments
SDP offer and answer (failure) (4.08 KB, text/plain)
2018-10-26 07:28 PDT, Lorenzo Miniero
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lorenzo Miniero 2018-10-26 07:28:55 PDT
Created attachment 353183 [details]
SDP offer and answer (failure)

The scenario is the following:

1. Safari STP (with VP8 disabled) sends an audio/video offer to an SFU;
2. the SFU is configured to only accept opus/vp8, and so accepts the audio m-line and rejects the video m-line;
3. eventually, the PeerConnection is supposed to be audio only.

This works in some cases, and doesn't in others. Specifically, it looks like it's failing when Safari puts the m-line video before the audio m-line. This is something our SFU supports correctly (the answer has the m-lines in the same order), but the setRemoteDescription in Safari fails with the following error:

    Failed to set remote answer sdp: The m= section:1 should be rejected.

Apparently, the WebRTC stack seems to think that, since the first m-line (video, mid=0) was rejected, the second m-line (audio, mid=1) should be rejected as well. It works as expected if the rejected video m-line comes after the first audio m-line instead. Not sure if this bug was already there or if it's a regression, as I'm not a regular Safari/MacOS user: not exactly sure why Safari randomly switches the m-line order either, as we always add tracks in the same order in JavaScript.

I'm attaching an example of SDP offer and answer that resulted in that issue. In case there's anything else I can provide that can be of use, please let me know.