Bug 161715 - [MediaStream] applyConstraints pt. 2 - advanced constraints
Summary: [MediaStream] applyConstraints pt. 2 - advanced constraints
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks: 160579
  Show dependency treegraph
 
Reported: 2016-09-07 14:58 PDT by Eric Carlson
Modified: 2016-10-30 13:19 PDT (History)
2 users (show)

See Also:


Attachments
Proposed patch. (47.23 KB, patch)
2016-09-07 15:29 PDT, Eric Carlson
dino: review+
Details | Formatted Diff | Diff
Patch for landing. (47.17 KB, patch)
2016-09-07 16:31 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2016-09-07 14:58:24 PDT
Add advanced constraint support to MediaStreamTrack.applyConstraints.
Comment 1 Radar WebKit Bug Importer 2016-09-07 14:59:21 PDT
<rdar://problem/28195461>
Comment 2 Eric Carlson 2016-09-07 15:29:46 PDT
Created attachment 288194 [details]
Proposed patch.
Comment 3 Dean Jackson 2016-09-07 16:02:27 PDT
Comment on attachment 288194 [details]
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=288194&action=review

> Source/WebCore/platform/mediastream/MediaConstraints.cpp:196
> +    // 2. If the constraint is required ('min', 'max', or 'exact'), and the settings
> +    //    dictionary's value for the constraint does not satisfy the constraint, the
> +    //    fitness distance is positive infinity.
> +    if (!m_exact.isEmpty() && m_exact.find(value) == notFound)
> +        return std::numeric_limits<double>::infinity();

So there is no concept of min or max on a StringConstraint?

> Source/WebCore/platform/mediastream/MediaConstraints.cpp:217
> +        double distance = fitnessDistance(value);
> +        if (distance < minimumDistance)
> +            minimumDistance = distance;

Maybe just minimumDistance = std::min(minimumDistance, fitnessDistance(value)); ?

> Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:447
> +    // 4. If candidates is empty, return undefined as the result of the SelectSettings() algorithm.
> +    if (candidates.isEmpty())
> +        return true;

How is true == undefined? Does this mean it is a valid but empty result?
Comment 4 Eric Carlson 2016-09-07 16:30:43 PDT
Comment on attachment 288194 [details]
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=288194&action=review

>> Source/WebCore/platform/mediastream/MediaConstraints.cpp:196
>> +        return std::numeric_limits<double>::infinity();
> 
> So there is no concept of min or max on a StringConstraint?

No, only exact and idea.

>> Source/WebCore/platform/mediastream/MediaConstraints.cpp:217
>> +            minimumDistance = distance;
> 
> Maybe just minimumDistance = std::min(minimumDistance, fitnessDistance(value)); ?

good idea, thanks!

>> Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:447
>> +        return true;
> 
> How is true == undefined? Does this mean it is a valid but empty result?

Correct, there are no valid constraints and none are impossible to support.
Comment 5 Eric Carlson 2016-09-07 16:31:18 PDT
Created attachment 288202 [details]
Patch for landing.
Comment 6 WebKit Commit Bot 2016-09-07 17:03:29 PDT
Comment on attachment 288202 [details]
Patch for landing.

Clearing flags on attachment: 288202

Committed r205574: <http://trac.webkit.org/changeset/205574>