[webrtc-pc] Extend RTCConfiguration with a boolean to always negotiate SCTP (#3072)

fippo has just created a new issue for https://github.com/w3c/webrtc-pc:

== Extend RTCConfiguration with a boolean to always negotiate SCTP ==
tl;dr: lets add a boolean flag `alwaysNegotiateSctp` to RTCConfiguration

[JSEP](https://datatracker.ietf.org/doc/html/rfc8829#name-initial-offers) says that
>  Lastly, if any datachannel has been created...
which means the m=application is always put after any RTP m-lines.

This has implications on BUNDLE since actually the SCTP m-line would be the ideal candidate for the first m-line, [quoting RFC 8843](  https://datatracker.ietf.org/doc/html/rfc8843#name-rejecting-a-media-descripti):
>  It is RECOMMENDED that the suggested offerer-tagged "m=" section be
> a bundled "m=" section that the offerer believes is unlikely that
>  the answerer will reject or move out of the BUNDLE group

since it is not even possible to reject data channels using the API. See [here](https://issues.chromium.org/issues/433898678) for a Chromium issue caused by negotiating away all supported video codecs.

With opt-in we can actually have the generated SDP put the SCTP m-line first. Spec-wise we need to override JSEP which is always a bit tricky.

This should not lead to interop problems as browsers already need to parse SDP with datachannel m-line first (I can add a WPT to assert).
Browsers not supporting this would not benefit but are not in a worse place than today.

Adding a boolean flag `alwaysNegotiateSctp` defaulting to `false` to `RTCConfiguration` seems like the best way.
An RTCOfferAnswerOption along the lines of `offerToReceiveAudio` would also work but I would prefer it on `RTCConfiguration` since  that works better with implicit SLD which is something we want to encourage.

As an additional benefit, this also removes the need for the bad pattern of developers creating a throwaway data channel (seen e.g. on Google Meet).
However, this is not transparent and there is no good way to feature detect since `RTCConfiguration` is not exposed on `window`. getConfiguration/setConfiguration would work, as would createOffer and inspecting the resulting SDP.

A similar thing was discussed in #735 but the current proposal is to only negotiate which, given BUNDLE (and in particular max-bundle), has no extra cost (apart from SCTP init and init-ack being exchanged)


Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/3072 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 19 August 2025 17:55:03 UTC