[webrtc-pc] replaceTrack and removeTrack

henbos has just created a new issue for https://github.com/w3c/webrtc-pc:

== replaceTrack and removeTrack ==
Paraphrasing the spec ignoring some details... replaceTrack is asynchronous:
- In parallel, check that track has not ended and queue a task to set the track if the pc is not closed and resolve the promise.

The track could be muted before the queued task is executed, this could be a problem, but ignoring that for now.
removeTrack is synchronous:
- Set the sender's track to null, etc.

What is the expected behavior of this?
```
sender = pc.addTrack(t1);
sender.replaceTrack(t2);
pc.removeTrack(sender);
```
I imagine this will result in the following steps:
```
sender = sender with track = t1;  // pc.addTrack
sender.track = null;  // pc.removeTrack
sender.track = t2;  // replaceTrack
```
The removeTrack still changes the direction of the transceiver, so I suspect the renegotiation will cause the remote track to be removed regardless of the order of things, but there might be races with what sender.track is when renegotiating?

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1677 using your GitHub account

Received on Friday, 1 December 2017 15:20:59 UTC