Re: Synchronous versus asynchronous getSourceInfos

I cobbled this together to see how it would work (this is Blink idl btw):

interface MediaStreamTrack {
    ...
    static void getSources(MediaStreamTrackSourcesCallback callback);
    ...
};

callback interface MediaStreamTrackSourcesCallback {
    boolean handleEvent(MediaStreamTrackSourcesResponse response);
};

[
    NoInterfaceObject
] interface MediaStreamTrackSourcesResponse {
    sequence<SourceInfo> sources();
};

Something along these lines?



On Fri, Jun 7, 2013 at 2:08 PM, Tommy Widenflycht (ᛏᚮᛘᛘᚤ) <tommyw@google.com
> wrote:

> Just a quick comment:
>
> Does the function need a failure callback? The current sync can't fail.
>
>
> On Tue, Jun 4, 2013 at 7:30 PM, Justin Uberti <juberti@google.com> wrote:
>
>> getSourceInfos is currently defined as synchronous [1] , but it will need
>> to reach down into the media subsystem to enumerate capture devices.
>> Previously, we have suggested that APIs like this should be async, to avoid
>> blocking the JS thread while waiting for the low-level operation to
>> complete. For getSourceInfos, I think this is still true - even if we
>> pre-enumerate devices when the browser starts, it is possible that a page
>> may make a request before the enumeration has completed, and will still
>> need to block.
>>
>> Therefore I suggest that as part of the futures discussion, we consider
>> whether getSourceInfos should be async, either
>>
>> void getSourceInfos(successCallback, failureCallback)
>>
>> or
>>
>> Future getSourceInfos()
>>
>> [1] http://dev.w3.org/2011/webrtc/editor/getusermedia.html#methods-1
>>
>>
>

Received on Friday, 7 June 2013 14:05:16 UTC