Re: New version of constrainable section of getusermedia

On 1/31/14 8:05 PM, Cullen Jennings (fluffy) wrote:
> There is a new version of the draft at
>
> http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html
>
> We deleted most of it text in it.
>
> Don’t Panic
>
> We deleted all the sections except section 11 which is the Constrainable interface. We just wanted to get the new Constrainable section out for everyone to read and discuss. This is the generic interface that deals with constraints. If people agree with this, we can go make all the changes to the rest of the document to line up with this interface and then publish the full draft.

I thank the editors and Jim for their hard work and for putting this 
topic in focus like this. The text has certainly benefited from the 
work-over.

We definitely need this for gUM, however I think it remains to be seen 
whether this pattern has applicability beyond gUM. In the last few 
months, we have extricated it from webrtc and we seem to be leaning the 
same way with MediaRecorder.

The reason I bring this up, is because the things I wish to pick on have 
to do with the abstraction attempt in the first place. These are things 
I've mentioned before, like:

[NoInterfaceObject]
interfaceConstrainable  {
     Capabilities  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#dfn-capabilities>  getCapabilities  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getCapabilities-Capabilities>  ();
     |Constraints|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-Constraints>   getConstraints  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getConstraints-Constraints>  ();
     Settings  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#dfn-settings>      getSettings  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getSettings-Settings>  ();
     void          applyConstraints  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-applyConstraints-void-Constraints-constraints-VoidFunction-successCallback-ConstraintErrorCallback-errorCallback>  (|Constraints|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-Constraints>  constraints,VoidFunction  successCallback,|ConstraintErrorCallback|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-ConstraintErrorCallback>  errorCallback);
                 attributeEventHandler  onoverconstrained  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-onoverconstrained>;
};


The fact that the Constrainable webidl interface is defined as operating 
on the discrete webidl dictionaries named "Capabilities", "Constraints" 
and "Settings", which A) except for Constraints, aren't defined! and B) 
more importantly, implies that all disparate uses of Constrainable (e.g. 
today's getUserMedia and, say, a future getCompanionCube) must operate 
on the same dictionaries "Capabilities", "Settings" and "Constraints", 
with implications like name-collisions for members, and a larger 
confusion about whether constraints, capabilities and settings in one 
domain must be expected to work in all others.

I can't believe this is intended, so my best-effort interpretation is 
that what we mean is for this to be a template, a pattern to repeat but 
not take literally. E.g:

[NoInterfaceObject]
interface GumConstrainable  {
     GumCapabilities  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#dfn-capabilities>  getCapabilities  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getCapabilities-Capabilities>  ();
     |GumConstraints|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-Constraints>   getConstraints  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getConstraints-Constraints>  ();
     GumSettings  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#dfn-settings>      getSettings  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getSettings-Settings>  ();
     void          applyConstraints  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-applyConstraints-void-Constraints-constraints-VoidFunction-successCallback-ConstraintErrorCallback-errorCallback>  (|GumConstraints|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-Constraints>  constraints,VoidFunction  successCallback,|ConstraintErrorCallback|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-ConstraintErrorCallback>  errorCallback);
                 attributeEventHandler  onoverconstrained  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-onoverconstrained>;
};


[NoInterfaceObject]
interfaceCCubeConstrainable  {
     CCubeCapabilities  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#dfn-capabilities>  getCapabilities  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getCapabilities-Capabilities>  ();
     |CCubeConstraints|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-Constraints>   getConstraints  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getConstraints-Constraints>  ();
     CCubeSettings  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#dfn-settings>      getSettings  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-getSettings-Settings>  ();
     void          applyConstraints  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-applyConstraints-void-Constraints-constraints-VoidFunction-successCallback-ConstraintErrorCallback-errorCallback>  (|CCubeConstraints|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-Constraints>  constraints,VoidFunction  successCallback,|ConstraintErrorCallback|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-ConstraintErrorCallback>  errorCallback);
                 attributeEventHandler  onoverconstrained  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constrainable-onoverconstrained>;
};


Unfortunately, there are no such things as templates in webidl, and just 
as we wouldn't excuse nonsense c++ or JS code in a spec, we shouldn't 
excuse nonsense webidl, perhaps more so.

I see a couple of solutions:

- One is to fold Constrainable back into gUM. This has some benefits in 
that the text can be made concrete and scoped to its relevance again.
- Another would be to keep it separate and name it GumConstrainable (as 
I have above) and promote copying of the *pattern*.
- A third option would be to go with "object" as the type throughout, 
giving us a spec based mostly on prose.

Separately from this issue, I believe my objections to forgoing 
dictionary as the type for ConstraintSet are well documented, so I wont 
bore you with repetition, except to point out the similarity here of 
seeking to define our API in webidl as much as possible.

dictionaryConstraints  {
     |ConstraintSet|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-ConstraintSet>?   mandatory  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constraints-mandatory>;
     |ConstraintSet|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-ConstraintSet>[]  optional  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-Constraints-optional>;
};


I see no need to accept null for mandatory, so I propose we remove nullable.
The optional part should be a sequence<ConstraintSet> not ConstraintSet[].

[NoInterfaceObject]
interfaceConstraintSet  {
     |ConstraintValues|  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#idl-def-ConstraintValues>  getter  <http://dev.w3.org/2011/webrtc/editor/archives/20140130/getusermedia.html#widl-ConstraintSet-getter-ConstraintValues-DOMString-name>  (DOMString  name);
};


This doesn't work. An interface can only be instantiated with a new 
operator and a name, which I don't think we mean here. Try:

typedef objectConstraintSet;


.: Jan-Ivar :.

> Thanks,  <The editors>
>
> ( And thanks to Jim who contributed a bunch of the text for this section )
>
> PS - Since this interface is equally important to webrtc and getUserMedia, I have taken the liberty to send it both lists.

Received on Monday, 3 February 2014 21:41:45 UTC