Re: [webrtc-pc] Ordering of stream "addtrack"/"removetrack" events vs. "track" event

Same comment as I put in

- When we update which tracks belong to which stream we should enqueue a task streamAddTrack/streamRemoveTrack to streamAddTracks/streamRemoveTracks.
- We proceed to update all states of the PC (meaning the state of transceivers, senders, receivers, streams and tracks) so that by the time we fire these events, it is safe to inspect the state of the PC without assumptions about order of events.
- We do not schedule a task to do anything, this must all be synchronous, or else the events fires after the promise resolves or the state of the PC may become obsolete (imagine calling SRD twice in a row, if you schedule to fire a task when that task fires for the first SRD you will see the effects of the second SRD when you inspect the PC).
- Before resolving the SRD promise, loop through all tasks and fire them.

Doing it any other way has observable side-effects.

GitHub Notification of comment by henbos
Please view or discuss this issue at using your GitHub account

Received on Sunday, 26 November 2017 17:17:34 UTC