Skip to content

Conversation

@ibc
Copy link
Member

@ibc ibc commented Oct 26, 2025

Details

  • Specification: RFC 8830
  • Corresponding PR in mediasoup: RtpParameters: add msid optional field mediasoup#1634
  • The msid field contains a string which consists on MEDIA_STREAM_ID MEDIA_STREAM_TRACK_ID?, where MEDIA_STREAM_ID is the id of the MediaStream the sender endpoint. The MEDIA_STREAM_ID is used to group media stream tracks in reception side, and the endpoint/browser uses it to sync audio and video inbound stream tracks / consumers.
  • Until now, when calling sendTransport.produce({track, ...}) we always append the track to a single and internally created MediaStream in each handler. Now produce() as a new optional streamId?: string field. If given, the new rtpParameters.msid field of the Producer will have the given streamId as first component (the msid id field, which is the stream id) instead of using this._sendStream.id.
  • So generated RtpParameters of the Producer will contain msid field.
  • When calling recvTransport.consume({ id, rtpParameters, ... }), the msid (if present) in rtpParameters will be used to generate the a=msid attribute in the media section of the remote SDP. Note: Just the MEDIA_STREAM_ID (the id field of the msid line) will be honoured. The MEDIA_STREAM_TRACK_ID will remain matching the consumer.id value.

Why?

  • If the sender wants to send mic audio, webcam video and screen sharing over the same sending transport, now it can say that only mic audio and webcam video tracks must be synced when in reception (remember that libwebrtc can only sync one inbound audio track with one inbound video track). To achieve that, the sender should call produce() for mic and webcam without streamId parameter (or with same streamId parameter) and then call produce() for screen sharing with a different streamId.

Bonus tracks

  • Improve some signatures and types.
  • RemoteSdp: Stop adding deprecated a=msid-semantic global attribute. It was dropped in favour of the new a=msid media session attribute as per RFC 8830.

Notes

  • msid should be an array because a MediaStreamTrack can belong to N MediaStream. Unfortunately sdp-transform is buggy here and assumes a single entry. PR done in mainstream project, although it would require both a new NPM version and new @types/sdp-transform version. Anyway, by design we only allow a single MediaStream so we are good.

TODO

  • Website documentation.

# Details

- Specification: [RFC 8830](https://datatracker.ietf.org/doc/html/rfc8830)
- WIP

## Bonus tracks

- Improve some signatures and types.
- `RemoteSdp`: Stop adding deprecated `a=msid-semantic` global attribute. It was dropped in favour of the new `a=msid` media session attribute as per [RFC 8830](https://datatracker.ietf.org/doc/html/rfc8830).
@ibc ibc changed the title RtpParamerters: add optional msid field RtpParameters: add msid optional field Oct 26, 2025
@ibc ibc marked this pull request as ready for review October 26, 2025 19:55
@ibc ibc marked this pull request as draft October 26, 2025 20:38
@ibc ibc marked this pull request as ready for review October 26, 2025 20:56
@ibc ibc merged commit 5bc27f9 into v3 Oct 30, 2025
7 checks passed
@ibc ibc deleted the add-rtp-parameters-msid branch October 30, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants