PSA: addTrack()/removeTrack/getSenders() and friends shipping in M64

502 views
Skip to first unread message

hb...@webrtc.org

unread,
Dec 18, 2017, 6:29:31 AM12/18/17
to discuss-webrtc
Significant portions of the RTP Media API are shipping, including addTrack().

This allows moving away from Chrome's legacy addStream()/removeStream() methods not in the spec. This is major milestone in spec-compliance, but there are still some caveats that need to be resolved before we are ready to deprecate addStream/removeStream()/getLocalStreams(), see notes below. Future releases will add more features, including methods on RTCRtpSender interface which initially only ships with the track attribute.

What's shipping?
RTCPeerConnection gets:
addTrack(track, streams...)
- removeTrack(sender)
- getSenders()
- ontrack

RTCRtpSender interface partially implemented with:
- track

RTCTrackEvent (for ontrack) implemented minus transceiver support:
- receiver
- track
- streams

Notes & caveats
RTCRtpTransceiver and related behavior is not implemented yet. This is currently in development.

addTrack() per-spec takes 1 track and 0, 1 or multiple streams as argument:
- 1 track, 1 stream case is shipping (this is the spec-compliant way of doing addStream).
- n > 1 streams case is not shipping, an exception is thrown. https://crbug.com/webrtc/7932
- 0 streams case: This works except it still generate a random stream ID in the SDP, resulting in a remote stream at the other endpoint. https://crbug.com/webrtc/7933

removeTrack(): Senders are not reusable as per-spec, instead they are removed from getSenders(), blocked on transceiver work.

getLocalStreams(): This is legacy API. Note that while addStream() adds to it, addTrack(track, stream) does not add a stream to getLocalStreams(). This will be fixed in the future, but apps should not use this legacy API.

getStats(): Locally added tracks and streams added with addTrack() don't show up in getStats(). This is a bug. https://crbug.com/webrtc/8616

hb...@webrtc.org

unread,
Dec 18, 2017, 6:31:01 AM12/18/17
to discuss-webrtc
Also, legacy createDTMFSender() does not work with addTrack(), for that you still need to use legacy addStream().

Philipp Hancke

unread,
Dec 18, 2017, 6:38:21 AM12/18/17
to WebRTC-discuss
👏👏👏 hbos

This is in M64 which is currently in beta. You have about six weeks before this hits stable to test now.

Also make sure you don't mix addTrack with getLocalStreams, the behaviour in that area is a bit... underspecified.
The interactions behave mostly like in Firefox, adapter.js should soon cover the last edge-case in https://github.com/webrtc/adapter/pull/726/

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/1dfafe4b-0b4d-41ec-a834-6c0900ea6162%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages