Re: [webrtc-pc] replaceTrack and removeTrack: Synchronous?

My main concern was if replaceTrack() would "undo" part of what removeTrack() was doing, like setting the track after it was null, which would arguably lead to unexpected behavior, whether or not racy. If this is a problem though, replaceTrack() could abort if it notices it has been removed when dispatching. I may be prematurely alarmed.

> > In the meantime I'm planning on implementing Chrome to do it synchronously
> 
> That would observably be in violation of the spec, since the spec says sender.track must be unchanged when the method returns, so I'm hoping we can avoid that.

Ack. I ran into problems because until Chrome supports transceivers, senders are removed (not just inactivated) on removeTrack(), but I should be able to get around those problems if async is the right approach.

>From [3 years ago](https://lists.w3.org/Archives/Public/public-webrtc/2014Sep/0012.html):
> > However, in our implementation, it's likely that confirming that a
> > track is a compatible replacement could require asynchronous
> > dispatches to a separate thread.  Blocking the main processing thread
> > for a synchronous dispatch would be very bad.  In general, I'd prefer
> > to have things that need to look at media be asynchronous to avoid any
> > risk that a synchronous dispatch is needed.
> 
> In an earlier discussion Harald brought up the example of cameras that 
> have built in encoders. If you switch track, isn't there a risk that the 
> new track is sourced by a camera that produces a format that can be 
> handled locally, but not by the remote end - and that won't be found out 
> until after an SDP O/A?

Sounds good, I suspect this has already been thought of and replaceTrack() should remain asynchronous.
But I still don't understand one crucial thing: Why does confirming that a track produces a compatible format require any interaction with an encoder (or any other thread), if which formats are compatible have already been negotiated and decided on setRemoteDescription()? Would this not be an "if format is in list of formats" type of operation?

-- 
GitHub Notification of comment by henbos
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1677#issuecomment-349585459 using your GitHub account

Received on Wednesday, 6 December 2017 09:38:41 UTC