RtpParameters: add msid optional field
#352
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Details
RtpParameters: addmsidoptional field mediasoup#1634msidfield contains a string which consists onMEDIA_STREAM_ID MEDIA_STREAM_TRACK_ID?, whereMEDIA_STREAM_IDis theidof theMediaStreamthe sender endpoint. TheMEDIA_STREAM_IDis used to group media stream tracks in reception side, and the endpoint/browser uses it to sync audio and video inbound stream tracks / consumers.sendTransport.produce({track, ...})we always append thetrackto a single and internally createdMediaStreamin each handler. Nowproduce()as a new optionalstreamId?: stringfield. If given, the newrtpParameters.msidfield of theProducerwill have the givenstreamIdas first component (themsididfield, which is the streamid) instead of usingthis._sendStream.id.RtpParametersof theProducerwill containmsidfield.recvTransport.consume({ id, rtpParameters, ... }), themsid(if present) inrtpParameterswill be used to generate thea=msidattribute in the media section of the remote SDP. Note: Just theMEDIA_STREAM_ID(theidfield of themsidline) will be honoured. TheMEDIA_STREAM_TRACK_IDwill remain matching theconsumer.idvalue.Why?
produce()for mic and webcam withoutstreamIdparameter (or with samestreamIdparameter) and then callproduce()for screen sharing with a differentstreamId.Bonus tracks
RemoteSdp: Stop adding deprecateda=msid-semanticglobal attribute. It was dropped in favour of the newa=msidmedia session attribute as per RFC 8830.Notes
msidshould be an array because aMediaStreamTrackcan belong to NMediaStream. Unfortunatelysdp-transformis 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-transformversion. Anyway, by design we only allow a singleMediaStreamso we are good.TODO