Bug 161715

Summary: [MediaStream] applyConstraints pt. 2 - advanced constraints
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: MediaAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 160579    
Attachments:
Description Flags
Proposed patch.
dino: review+
Patch for landing. none

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>