Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp

Issue 1899943008: Macro-based constraints Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some more code Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
index 24262199521b02c5a0611fcaaf55b9a42ba4f654..26fc2ed694bb4b05a3abbae6e43da04aa912ddca 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaConstraintsImpl.cpp
@@ -513,45 +513,15 @@ void copyBooleanConstraint(const ConstrainBooleanParameters& blinkForm, BooleanC
void copyConstraints(const MediaTrackConstraintSet& constraintsIn, WebMediaTrackConstraintSet& constraintBuffer)
{
- if (constraintsIn.hasWidth()) {
- copyLongConstraint(constraintsIn.width(), constraintBuffer.width);
- }
- if (constraintsIn.hasHeight()) {
- copyLongConstraint(constraintsIn.height(), constraintBuffer.height);
- }
- if (constraintsIn.hasAspectRatio()) {
- copyDoubleConstraint(constraintsIn.aspectRatio(), constraintBuffer.aspectRatio);
- }
- if (constraintsIn.hasFrameRate()) {
- copyDoubleConstraint(constraintsIn.frameRate(), constraintBuffer.frameRate);
- }
- if (constraintsIn.hasFacingMode()) {
- copyStringConstraint(constraintsIn.facingMode(), constraintBuffer.facingMode);
- }
- if (constraintsIn.hasVolume()) {
- copyDoubleConstraint(constraintsIn.volume(), constraintBuffer.volume);
- }
- if (constraintsIn.hasSampleRate()) {
- copyLongConstraint(constraintsIn.sampleRate(), constraintBuffer.sampleRate);
- }
- if (constraintsIn.hasSampleSize()) {
- copyLongConstraint(constraintsIn.sampleSize(), constraintBuffer.sampleSize);
- }
- if (constraintsIn.hasEchoCancellation()) {
- copyBooleanConstraint(constraintsIn.echoCancellation(), constraintBuffer.echoCancellation);
- }
- if (constraintsIn.hasLatency()) {
- copyDoubleConstraint(constraintsIn.latency(), constraintBuffer.latency);
- }
- if (constraintsIn.hasChannelCount()) {
- copyLongConstraint(constraintsIn.channelCount(), constraintBuffer.channelCount);
- }
- if (constraintsIn.hasDeviceId()) {
- copyStringConstraint(constraintsIn.deviceId(), constraintBuffer.deviceId);
- }
- if (constraintsIn.hasGroupId()) {
- copyStringConstraint(constraintsIn.groupId(), constraintBuffer.groupId);
+
+#define CONSTRAINT_ITEM(lowercase, uppercase, datatype) \
+ 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
+ copy##datatype##Constraint(constraintsIn.lowercase(), constraintBuffer.lowercase); \
}
+
+ CONSTRAINT_LIST
+
+#undef CONSTRAINT_ITEM
}
WebMediaConstraints create(ExecutionContext* context, const MediaTrackConstraints& constraintsIn, MediaErrorState& errorState)
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/exported/WebMediaConstraints.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698