Chromium Code Reviews| 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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 if (blinkForm.hasIdeal()) { | 506 if (blinkForm.hasIdeal()) { |
| 507 webForm.setIdeal(blinkForm.ideal()); | 507 webForm.setIdeal(blinkForm.ideal()); |
| 508 } | 508 } |
| 509 if (blinkForm.hasExact()) { | 509 if (blinkForm.hasExact()) { |
| 510 webForm.setExact(blinkForm.exact()); | 510 webForm.setExact(blinkForm.exact()); |
| 511 } | 511 } |
| 512 } | 512 } |
| 513 | 513 |
| 514 void copyConstraints(const MediaTrackConstraintSet& constraintsIn, WebMediaTrack ConstraintSet& constraintBuffer) | 514 void copyConstraints(const MediaTrackConstraintSet& constraintsIn, WebMediaTrack ConstraintSet& constraintBuffer) |
| 515 { | 515 { |
| 516 if (constraintsIn.hasWidth()) { | 516 |
| 517 copyLongConstraint(constraintsIn.width(), constraintBuffer.width); | 517 #define CONSTRAINT_ITEM(lowercase, uppercase, datatype) \ |
| 518 if (constraintsIn.has##uppercase()) { \ | |
|
tommi (sloooow) - chröme
2016/05/01 17:52:16
crazy question. Instead of all of these type spec
hta - Chromium
2016/05/02 08:22:00
two problems with that:
- the constraints types a
tommi (sloooow) - chröme
2016/05/03 16:49:34
What I'm wondering is if it would make more sense
| |
| 519 copy##datatype##Constraint(constraintsIn.lowercase(), constraintBuffer.l owercase); \ | |
| 518 } | 520 } |
| 519 if (constraintsIn.hasHeight()) { | 521 |
| 520 copyLongConstraint(constraintsIn.height(), constraintBuffer.height); | 522 CONSTRAINT_LIST |
| 521 } | 523 |
| 522 if (constraintsIn.hasAspectRatio()) { | 524 #undef CONSTRAINT_ITEM |
| 523 copyDoubleConstraint(constraintsIn.aspectRatio(), constraintBuffer.aspec tRatio); | |
| 524 } | |
| 525 if (constraintsIn.hasFrameRate()) { | |
| 526 copyDoubleConstraint(constraintsIn.frameRate(), constraintBuffer.frameRa te); | |
| 527 } | |
| 528 if (constraintsIn.hasFacingMode()) { | |
| 529 copyStringConstraint(constraintsIn.facingMode(), constraintBuffer.facing Mode); | |
| 530 } | |
| 531 if (constraintsIn.hasVolume()) { | |
| 532 copyDoubleConstraint(constraintsIn.volume(), constraintBuffer.volume); | |
| 533 } | |
| 534 if (constraintsIn.hasSampleRate()) { | |
| 535 copyLongConstraint(constraintsIn.sampleRate(), constraintBuffer.sampleRa te); | |
| 536 } | |
| 537 if (constraintsIn.hasSampleSize()) { | |
| 538 copyLongConstraint(constraintsIn.sampleSize(), constraintBuffer.sampleSi ze); | |
| 539 } | |
| 540 if (constraintsIn.hasEchoCancellation()) { | |
| 541 copyBooleanConstraint(constraintsIn.echoCancellation(), constraintBuffer .echoCancellation); | |
| 542 } | |
| 543 if (constraintsIn.hasLatency()) { | |
| 544 copyDoubleConstraint(constraintsIn.latency(), constraintBuffer.latency); | |
| 545 } | |
| 546 if (constraintsIn.hasChannelCount()) { | |
| 547 copyLongConstraint(constraintsIn.channelCount(), constraintBuffer.channe lCount); | |
| 548 } | |
| 549 if (constraintsIn.hasDeviceId()) { | |
| 550 copyStringConstraint(constraintsIn.deviceId(), constraintBuffer.deviceId ); | |
| 551 } | |
| 552 if (constraintsIn.hasGroupId()) { | |
| 553 copyStringConstraint(constraintsIn.groupId(), constraintBuffer.groupId); | |
| 554 } | |
| 555 } | 525 } |
| 556 | 526 |
| 557 WebMediaConstraints create(ExecutionContext* context, const MediaTrackConstraint s& constraintsIn, MediaErrorState& errorState) | 527 WebMediaConstraints create(ExecutionContext* context, const MediaTrackConstraint s& constraintsIn, MediaErrorState& errorState) |
| 558 { | 528 { |
| 559 WebMediaConstraints constraints; | 529 WebMediaConstraints constraints; |
| 560 WebMediaTrackConstraintSet constraintBuffer; | 530 WebMediaTrackConstraintSet constraintBuffer; |
| 561 Vector<WebMediaTrackConstraintSet> advancedBuffer; | 531 Vector<WebMediaTrackConstraintSet> advancedBuffer; |
| 562 copyConstraints(constraintsIn, constraintBuffer); | 532 copyConstraints(constraintsIn, constraintBuffer); |
| 563 if (constraintsIn.hasAdvanced()) { | 533 if (constraintsIn.hasAdvanced()) { |
| 564 for (const auto& element : constraintsIn.advanced()) { | 534 for (const auto& element : constraintsIn.advanced()) { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 590 | 560 |
| 591 WebMediaConstraints create() | 561 WebMediaConstraints create() |
| 592 { | 562 { |
| 593 WebMediaConstraints constraints; | 563 WebMediaConstraints constraints; |
| 594 constraints.initialize(); | 564 constraints.initialize(); |
| 595 return constraints; | 565 return constraints; |
| 596 } | 566 } |
| 597 | 567 |
| 598 } // namespace MediaConstraintsImpl | 568 } // namespace MediaConstraintsImpl |
| 599 } // namespace blink | 569 } // namespace blink |
| OLD | NEW |