Re: [mediacapture-main] getUserMedia algorithm should be made more synchronous

> Is the spec prescribing a specific order for the example above?

TL;DR; I certainly hope not. In my experience, the spec tends to use 
MUST when giving guarantees.

In my view, a specification is a grand simplification of an actual 
implementation. 

For instance, I'm working on adding the deviceId constraint to 
*getUserMedia* on Firefox right now, and here's what I'm looking at 
having it do to accomplish what it needs to do:

 * Just in case a deviceId constraint is used, first call (the 
internal equivalent of) mediaDevices.enumerateDevices() to get all 
persistent device ids anonymized for the current origin (essentially 
one-way-hashes of raw device-ids with an origin-specific key).
    * This is a cross-process call to the *chrome* process to access 
the browser's profile-dir (we must be on chrome process's main thread 
to access it), then over to a second thread there to do file io to 
read the persistent origin-key list from disk, then message back an 
existing or new key.
    * Once back on the *content* process, dispatch over to the media 
thread to read the raw device list, and back (because our crypto 
library has trouble off-main-thread).
    * Back on main thread, hash raw device-ids with the origin-key, to
 produce an origin-relevant list.

* With origin-relevant list in hand, dispatch yet again to media 
thread where constraints are applied.
* Then from there, notify the permission doorhanger code which is 
written in JavaScript (main thread).
* Then if the end-user ever responds to any of the choices (or 
persitent permissions have been granted), communicate back to media 
thread which dispatches results back to main thread where promises are
 resolved/rejected.

Any definition of "*Run the following steps asynchronously*" stricter 
than "please do something equivalent to this sometime later" would 
disallow much of this. So no, I would not assume much about timing 
here.

-- 
GitHub Notif of comment by jan-ivar
See 
https://github.com/w3c/mediacapture-main/issues/174#issuecomment-106901042

Received on Friday, 29 May 2015 18:45:11 UTC