This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25836 - add note about addtrack being async
Summary: add note about addtrack being async
Status: RESOLVED LATER
Alias: None
Product: WebRTC Working Group
Classification: Unclassified
Component: WebRTC API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Web RTC Working Group
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-20 20:26 UTC by Cullen Jennings
Modified: 2014-12-15 10:39 UTC (History)
4 users (show)

See Also:


Attachments

Description Cullen Jennings 2014-05-20 20:26:49 UTC
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
Comment 1 Adam Bergkvist 2014-05-21 14:15:00 UTC
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).
Comment 2 Harald Alvestrand 2014-10-31 17:55:35 UTC
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.
Comment 3 Justin Uberti 2014-10-31 18:02:07 UTC
JSFiddle for addStream: http://jsfiddle.net/bvmkdsa4/2/ (needs some tweaking to work in non-webkit browsers)
Comment 4 Adam Bergkvist 2014-11-04 13:54:03 UTC
(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.
Comment 5 Adam Bergkvist 2014-11-04 14:00:37 UTC
this = our decision (not what I wrote)
Comment 6 Dominique Hazael-Massieux 2014-12-15 10:39:44 UTC
WebRTC API bugs have been moved to github issues: https://github.com/w3c/webrtc-pc/issues

Please subscribe to the issues you want to keep watching.