Commit 20078f72 authored by hta's avatar hta Committed by Commit bot

Constraints: Make advanced list be a list.

Previous behavior: A list of optional constraints resulted
in a single advanced element, with one field for each value.

New behavior: A list of optional constraints results in a
list of advanced elements, with one field set for each value.

The difference is important when there are mulitple values
with the same name. For constraints with distinct names, there
should be no difference.

BUG=594929

Review URL: https://codereview.chromium.org/1808173002

Cr-Commit-Position: refs/heads/master@{#381724}
parent 6d78ae46
...@@ -434,14 +434,15 @@ static WebMediaConstraints createFromNamedConstraints(ExecutionContext* context, ...@@ -434,14 +434,15 @@ static WebMediaConstraints createFromNamedConstraints(ExecutionContext* context,
return constraints; return constraints;
// We ignore unknow names and syntax errors in optional constraints. // We ignore unknow names and syntax errors in optional constraints.
MediaErrorState ignoredErrorState; MediaErrorState ignoredErrorState;
parseOldStyleNames(context, optional, false, advanced, ignoredErrorState); Vector<WebMediaTrackConstraintSet> advancedVector;
if (advanced.isEmpty()) { for (const auto& optionalConstraint : optional) {
WebVector<WebMediaTrackConstraintSet> emptyVector; WebMediaTrackConstraintSet advancedElement;
constraints.initialize(basic, emptyVector); WebVector<WebMediaConstraint> elementAsList(&optionalConstraint, 1);
} else { parseOldStyleNames(context, elementAsList, false, advancedElement, ignoredErrorState);
WebVector<WebMediaTrackConstraintSet> advancedVector(&advanced, 1); if (!advancedElement.isEmpty())
constraints.initialize(basic, advancedVector); advancedVector.append(advancedElement);
} }
constraints.initialize(basic, advancedVector);
return constraints; return constraints;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment