w3c / webrtc-pc

WebRTC 1.0 API
https://w3c.github.io/webrtc-pc/
Other
438 stars 115 forks source link

add note about addtrack being async #156

Closed dontcallmedom closed 9 years ago

dontcallmedom commented 9 years ago

Originally reported on W3C Bugzilla ISSUE-25836 Tue, 20 May 2014 20:26:49 GMT Reported by Cullen Jennings Assigned to

add notes that

Since addTrack is async, and getTracks is not, after you add one, there may be some time before it shows up in getTracks

dontcallmedom commented 9 years ago

Original comment by Adam Bergkvist on W3C Bugzilla. Wed, 21 May 2014 14:15:00 GMT

I suggest to keep addTrack() sync for simplicity.

The problem of which tracks that are included in what offer/answer can be solved by having createO/A() snapshot the list of currently added tracks at the point the method (creatO/A()) is called. According to Justin, that's how it works in Chrome today (but for streams).

dontcallmedom commented 9 years ago

Original comment by Harald Alvestrand on W3C Bugzilla. Fri, 31 Oct 2014 17:55:35 GMT

The addtrack operation is synchronous, but it causes things to happen that are easier to describe as a queued task (stuff that happens in stable state).

Exemplar case:

createOffer().then(offer =>) AddTrack(track)

Will the offer include the added track or not?

There should be a test written for this behaviour, so that we know whether the behaviour is consistent or inconsistent between browsers. It should be defined and deterministic, and the spec should say which is true.

dontcallmedom commented 9 years ago

Original comment by Justin Uberti on W3C Bugzilla. Fri, 31 Oct 2014 18:02:07 GMT

JSFiddle for addStream: http://jsfiddle.net/bvmkdsa4/2/ (needs some tweaking to work in non-webkit browsers)

dontcallmedom commented 9 years ago

Original comment by Adam Bergkvist on W3C Bugzilla. Tue, 04 Nov 2014 13:54:03 GMT

(In reply to Harald Alvestrand from comment #2)

The addtrack operation is synchronous, but it causes things to happen that are easier to describe as a queued task (stuff that happens in stable state).

Exemplar case:

createOffer().then(offer =>) AddTrack(track)

Will the offer include the added track or not?

What do we want the answer to be?

With addTrack() async the answer is no. The task that adds the tracks is still on the operations queue when the createOffer task is picked up.

With addTrack(), with a return value, we can decide how we want it to be. If a snapshot of the added tracks is taken when createOffer() is picked up by the JS scheduler and stored for later processing in the queued operation, the answer is no. If we don't look at the added tracks until the createOffer task is picked up, then the track will be included and the answer is yes.

We need to document this.

dontcallmedom commented 9 years ago

Original comment by Adam Bergkvist on W3C Bugzilla. Tue, 04 Nov 2014 14:00:37 GMT

this = our decision (not what I wrote)

stefhak commented 9 years ago

Message sent to list: https://lists.w3.org/Archives/Public/public-webrtc/2015Apr/0135.html Waiting for discussion.

stefhak commented 9 years ago

I think this has been OBE; addTrack and addTransceiver are both synchronous. I propose we close this issue with no action.

alvestrand commented 9 years ago

Closing.