[mediacapture-record] Shouldn't remaining async methods run "in parallel"?

jan-ivar has just created a new issue for https://github.com/w3c/mediacapture-record:

== Shouldn't remaining async methods run "in parallel"? ==
A long-overdue follow-up to https://github.com/w3c/mediacapture-record/issues/54, apart from `start()`, which I changed in https://github.com/w3c/mediacapture-record/pull/61, the other async methods still run solely on the main thread. Take [requestData](https://w3c.github.io/mediacapture-record/MediaRecorder.html#dom-mediarecorder-requestdata) for example:

*"When ... invoked, the UA MUST run the following steps:*
 1. *If state is inactive throw an InvalidStateError DOMException and terminate these steps. Otherwise the UA MUST queue a task, using the DOM manipulation task source, that runs the following steps:"*

While this works, it begs the question of why it's asynchronous in the first place. Anything we do in a task queued on main-thread, we could arguably have done synchronously already.

Instead, the intent was likely to let implementations communicate with its off-main-thread recording thread without blocking main-thread. The current text allows very limited time to do this, if at all.

I suggest we rewrite the steps to run [in parallel](https://html.spec.whatwg.org/#in-parallel), reference what needs to be done in parallel, e.g. data gathering, and queue the main-thread task from there, which references the data and puts it into a Blob (Blob technically is a DOM object, and shouldn't be accessed off-main-thread, but in this spec it appears used as a shorthand for the target buffer of off-main-thread data gathering. We might want to clean that up as well).

For some of the methods, like `resume()` and `pause()`, there appears to be very little to do off-main-thread, but unless we want them synchronous, they should probably receive the same treatment?

I have a PR for a similar problem in imageCapture in https://github.com/w3c/mediacapture-image/issues/184.


Please view or discuss this issue at https://github.com/w3c/mediacapture-record/issues/131 using your GitHub account

Received on Monday, 14 August 2017 16:44:02 UTC