Re: Fwd: Re: Syntax options for constraints structure

On 05/13/2012 05:59 PM, Anant Narayanan wrote:
> On 5/12/2012 11:30 PM, Harald Alvestrand wrote:
>> On 05/11/2012 09:46 PM, Anant Narayanan wrote:
>>> navigator.getUserMedia({
>>>   video: {
>>>     mandatory: {},
>>>     optional: [
>>>       {
>>>         minWidth: 640,
>>>         minHeight: 480,
>>>         minFramerate: 30
>>>       },
>>>       {
>>>         minWidth: 320,
>>>         minHeight: 240,
>>>         minFramerate: 15
>>>       }
>>>     ]
>>>   }
>>> });
>>
>> Note my reaction to grouping is the same as Dan's: It's not clear what
>> the semantics are.
>>
>> If you intend to comment on Dan's algorithm proposal, I think your
>> example is wrong; if you're proposing an alternative evaluation
>> algorithm for optional constraints, I don't understand what it is.
>>
>> Can you clarify?
>
> Sorry, my first message wasn't very clear; I was proposing an 
> alternative evaluation algorithm because I think the more common case 
> would be for an app to work with a set of given constraints. The 
> algorithm would be as follows:
>
> - UA evaluates all constraints in the mandatory block, if any one of 
> them could not be satisfied, onerror is called.
>
> - UA evaluates each set in the optional block in order, starting from 
> offset 0, as if it were a mandatory block. Except, if any one 
> constraint in a set could not be satisfied, the next set is evaluated 
> instead of calling onerror.
>
> - If the UA was able to meet all constraints in the very first set in 
> the optional block, for example, none of the others will be evaluated; 
> and onsuccess is called immediately.
>
> - If none of the optional constraints could be satisfied, onsuccess is 
> called as normal.
>
> In Dan's original proposal, I haven't seen any examples where many of 
> the individual constraints could not be grouped together because they 
> conflict with each other.
>
> In other words, I don't see why a web developer would prioritize 
> "aspectRatio" over "minFramerate"; they are two different things, why 
> would one take priority over the other? On the other hand, I can see 
> why a developer would prioritize 30fps over 15fps, and they belong in 
> different sets.

Shouldn't that choice be left to the developer?

If I want to fit the frame in a vertical row of thumbnails, and expect 
users to all have SW that crops sensibly, I may consider the aspect 
ratio very important, and the framerate not very important (it's just a 
thumbnail); if I want to show a sports event with rapid movement, I may 
consider framerate more important, but leave the aspect ratio at 
whatever the transmission sees fit to offer.

>
> It might be that I'm missing some key element, Tim also mentioned the 
> possibility that JS doesn't know what is going to conflict in advance. 
> A concrete example of when two constraints with different keys can't 
> be in the same set will really help me in understanding this better.

For instance, if you have a hardware VP8 encoder capable of 60 FPS, but 
only able to operate in VGA mode, and a software encoder capable of max 
20 FPS, but capable of both QVGA and VGA sizes, the following set would 
be a conflict:

{
    min-framerate: 60
    max-x-resolution: 320
}

I don't know how realistic this is, but it's clear that it can happen.

Received on Sunday, 13 May 2012 16:54:17 UTC