Re: [mediacapture-image] Clarify meaning of PTZ constraints presence (#256)

Now that required image capture constraints are not allowed any more, I think that the original option 3 (`ConstrainDoubleOrBoolean` or `(double or boolean or ConstrainDoubleRangeOrBooleanParameters)`) is overly complex as I described in https://github.com/w3c/mediacapture-image/pull/257#issuecomment-700729392.

However, I still think that defining the effect of `{pan: true, tilt: true}` etc. on fitness distance is needed and useful. I know that @youennf has repeatedly said that he dislikes the use of fitness distance for device selection between PTZ cameras and non-PTZ cameras. But would you still agree that it would be useful that `navigator.mediaDevices.getUserMedia({video: {pan: true, tilt: true}})` would prefer pan-tilt PTZ cameras over zoom-only PTZ cameras if the user grants the PTZ permission? If so then pan-tilt PTZ camera settings dictionaries should have better fitness i.e. lower fitness distance than zoom-only PTZ camera settings dictionaries.

So, how about that we define a new typedef `ConstrainDoubleOrCapability` (bikeshed the name as you will) to be `(double or boolean or ConstrainDoubleRange)`? So booleans would be allowed only as bare values. And then we could define that

- If settings dictionary's value for the constraint exists (that is to say the source device supports the relevant capability and the UA exposes it):
  - If the constraint is required (in the advanced constraint sets) and the constraint value is `false`, the settings dictionary's value for the constraint does not satisfy the constraint. Thus the fitness distance step 2 applies and the fitness distance is positive infinity.
  - If the constraint is required (in the advanced constraint sets) and the constraint value is `true`, the settings dictionary's value for the constraint satisfies the constraint. Thus the fitness distance step 2 does not apply.
  - If the ideal value is specified and is a boolean value, the actual value is `true`. Thus the fitness distance step 6 applies and the fitness distance is `(actual == ideal) ? 0 : 1`.
- If settings dictionary's value for the constraint does not exist (that is to say either the source device does not support the relevant capability or the UA does not expose it):
  - If the constraint is required (in the advanced constraint sets) and the constraint value is `false`, the settings dictionary's value for the constraint satisfies the constraint. Thus the fitness distance step 2 does not apply.
  - If the constraint is required (in the advanced constraint sets) and the constraint value is `true`, a double value or a `ConstrainDoubleRange` value (i.e. not `false`), the settings dictionary's value for the constraint does not satisfy the constraint. Thus the fitness distance step 2 applies and the fitness distance is positive infinity.
  - If the ideal value is specified and is a double value, there are no actual values and the fitness distance is 1.
  - If the ideal value is specified and is a boolean value, the actual value is `false`. Thus the fitness distance step 6 applies and the fitness distance is `(actual == ideal) ? 0 : 1`.

-- 
GitHub Notification of comment by eehakkin
Please view or discuss this issue at https://github.com/w3c/mediacapture-image/issues/256#issuecomment-701613796 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 30 September 2020 20:01:36 UTC