Re: [webrtc-pc] The threading model of webrtc-pc: When are effects of in-parallel stuff surfaced? (#2502)

Sorry I'm not familiar enough with how Chrome works to follow, but we can't break the synchronous nature of addTrack.

> why are we not awaiting for SRD() before we do addTrack()?

As definers of the API, it's our job to define what happens, not ask why it's done. ;)

But since you ask me to defend taking action: The reason I think we must solve this is this one:
```js
pc.setRemoteDescription(offer);
button.onclick = () => pc.addTrack(track, stream); // Must always get associated
```
 1. If addTrack happens right before SRD, then SRD associates it.
 2. If addTrack happens right after SRD success, then addTrack associates it.
 3. If addTrack happens right in the middle of SRD, then it is not associated (theoretically)

Since both 1 and 2 associate, it seems pretty darn obvious that 3 should as well. Especially since add

Note I haven't actually been able to _observe_ 3 in any implementation, as it's hard to test.
I think it might suffice to say something like _"If addTrack was called during the process to apply description, then start the process over."_ I'll do a PR.

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

Received on Tuesday, 31 March 2020 19:26:09 UTC