OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/media_stream_constraints_util_sets.h" | 5 #include "content/renderer/media/media_stream_constraints_util_sets.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "content/renderer/media/media_stream_constraints_util.h" | 9 #include "content/renderer/media/media_stream_constraints_util.h" |
10 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 10 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 const blink::WebMediaTrackConstraintSet& constraint_set) { | 526 const blink::WebMediaTrackConstraintSet& constraint_set) { |
527 return ResolutionSet( | 527 return ResolutionSet( |
528 MinDimensionFromConstraint(constraint_set.height), | 528 MinDimensionFromConstraint(constraint_set.height), |
529 MaxDimensionFromConstraint(constraint_set.height), | 529 MaxDimensionFromConstraint(constraint_set.height), |
530 MinDimensionFromConstraint(constraint_set.width), | 530 MinDimensionFromConstraint(constraint_set.width), |
531 MaxDimensionFromConstraint(constraint_set.width), | 531 MaxDimensionFromConstraint(constraint_set.width), |
532 MinAspectRatioFromConstraint(constraint_set.aspect_ratio), | 532 MinAspectRatioFromConstraint(constraint_set.aspect_ratio), |
533 MaxAspectRatioFromConstraint(constraint_set.aspect_ratio)); | 533 MaxAspectRatioFromConstraint(constraint_set.aspect_ratio)); |
534 } | 534 } |
535 | 535 |
| 536 DiscreteSet<std::string> StringSetFromConstraint( |
| 537 const blink::StringConstraint& constraint) { |
| 538 if (!constraint.HasExact()) |
| 539 return DiscreteSet<std::string>::UniversalSet(); |
| 540 |
| 541 std::vector<std::string> elements; |
| 542 for (const auto& entry : constraint.Exact()) |
| 543 elements.push_back(entry.Ascii()); |
| 544 |
| 545 return DiscreteSet<std::string>(std::move(elements)); |
| 546 } |
| 547 |
| 548 DiscreteSet<bool> BoolSetFromConstraint( |
| 549 const blink::BooleanConstraint& constraint) { |
| 550 if (!constraint.HasExact()) |
| 551 return DiscreteSet<bool>::UniversalSet(); |
| 552 |
| 553 return DiscreteSet<bool>({constraint.Exact()}); |
| 554 } |
| 555 |
536 } // namespace content | 556 } // namespace content |
OLD | NEW |