| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 } | 595 } |
| 596 constraints.initialize(constraintBuffer, advancedBuffer); | 596 constraints.initialize(constraintBuffer, advancedBuffer); |
| 597 return constraints; | 597 return constraints; |
| 598 } | 598 } |
| 599 | 599 |
| 600 WebMediaConstraints create(ExecutionContext* context, const MediaTrackConstraint
s& constraintsIn, MediaErrorState& errorState) | 600 WebMediaConstraints create(ExecutionContext* context, const MediaTrackConstraint
s& constraintsIn, MediaErrorState& errorState) |
| 601 { | 601 { |
| 602 WebMediaConstraints standardForm = convertConstraintsToWeb(constraintsIn); | 602 WebMediaConstraints standardForm = convertConstraintsToWeb(constraintsIn); |
| 603 if (constraintsIn.hasOptional() || constraintsIn.hasMandatory()) { | 603 if (constraintsIn.hasOptional() || constraintsIn.hasMandatory()) { |
| 604 if (!standardForm.isEmpty()) { | 604 if (!standardForm.isEmpty()) { |
| 605 UseCounter::count(context, UseCounter::MediaStreamConstraintsOldAndN
ew); |
| 605 errorState.throwTypeError("Malformed constraint: Cannot use both opt
ional/mandatory and specific or advanced constraints."); | 606 errorState.throwTypeError("Malformed constraint: Cannot use both opt
ional/mandatory and specific or advanced constraints."); |
| 606 return WebMediaConstraints(); | 607 return WebMediaConstraints(); |
| 607 } | 608 } |
| 608 Vector<NameValueStringConstraint> optional; | 609 Vector<NameValueStringConstraint> optional; |
| 609 Vector<NameValueStringConstraint> mandatory; | 610 Vector<NameValueStringConstraint> mandatory; |
| 610 if (!parse(constraintsIn, optional, mandatory)) { | 611 if (!parse(constraintsIn, optional, mandatory)) { |
| 611 errorState.throwTypeError("Malformed constraints object."); | 612 errorState.throwTypeError("Malformed constraints object."); |
| 612 return WebMediaConstraints(); | 613 return WebMediaConstraints(); |
| 613 } | 614 } |
| 614 UseCounter::count(context, UseCounter::MediaStreamConstraintsNameValue); | 615 UseCounter::count(context, UseCounter::MediaStreamConstraintsNameValue); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 MediaTrackConstraintSet element; | 766 MediaTrackConstraintSet element; |
| 766 convertConstraintSet(it, element); | 767 convertConstraintSet(it, element); |
| 767 advancedVector.append(element); | 768 advancedVector.append(element); |
| 768 } | 769 } |
| 769 if (!advancedVector.isEmpty()) | 770 if (!advancedVector.isEmpty()) |
| 770 output.setAdvanced(advancedVector); | 771 output.setAdvanced(advancedVector); |
| 771 } | 772 } |
| 772 | 773 |
| 773 } // namespace MediaConstraintsImpl | 774 } // namespace MediaConstraintsImpl |
| 774 } // namespace blink | 775 } // namespace blink |
| OLD | NEW |