addTrack doesn't appear to reuse available RTCRtpTransceiver (Unified Plan)
Reported by
xsvengo...@gmail.com,
Jan 16
(6 days ago)
|
||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0 Steps to reproduce the problem: 1. Open the test page 2. Start 3. Call 4. Add Video 5. Test (observe the console prints a 3rd active transceiver) 6. Remove Video 7. Test (observe the console prints the 3rd transceiver is recvonly and the sender track is null 8. Add Video 9. Test (observe the console prints 4 transceivers) What is the expected behavior? Following the steps above I expected only 3 transceivers to be printed in step 9. What went wrong? The spec talks about reusing RTCRtpTransceivers for the addTrack function (http://w3c.github.io/webrtc-pc/#rtcpeerconnection-interface-extensions) and I noticed it wasn't working for me. The attached sample is a version of https://webrtc.github.io/samples/src/content/peerconnection/pc1/ Did this work before? N/A Does this work in other browsers? N/A Chrome version: 72.0.3626.53 (Official Build) beta (64-bit) (cohort: Beta) Channel: n/a OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version:
,
Jan 17
(6 days ago)
,
Jan 17
(5 days ago)
hbos@: can you take a look?
,
Jan 17
(5 days ago)
As noted in #1, one of the criteria of reusing a transceiver is "The sender has never been used to send." The list of transceivers can grow, but it cannot shrink. When RTCRtpTransceiver.stop() is shipped, you will be able to clean up the SDP a bit, but getTransceivers().length will forever grow. If you want to reuse transceivers you should make use of the RTCRtpTransceiver.direction attribute (changing the direction will trigger onnegotiationneeded). With RTCRtpSender.replaceTrack() you can seamlessly change which track to send (or stop sending if you set it to null) which doesn't even require renegotiation, which may be a good idea if you want to switch camera or mute the stream. If you want to get into the "transceiver mindset" you might as well start using addTransceiver() instead of addTrack() to make it more clear that you are in fact adding transceivers when you're doing this. Not adding an unnecessary number of transceivers can be a good idea, in case resources are wasted on encoders and decoders that aren't used. |
||||
►
Sign in to add a comment |
||||
Comment 1 by xsvengo...@gmail.com
, Jan 16 (6 days ago)