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

Unified Diff: third_party/WebKit/public/platform/WebMediaConstraints.h

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
Index: third_party/WebKit/public/platform/WebMediaConstraints.h
diff --git a/third_party/WebKit/public/platform/WebMediaConstraints.h b/third_party/WebKit/public/platform/WebMediaConstraints.h
index 49afc70d31ece5428de3a45425abbc0ea88ee77d..cd26d692049a48efe0cae8210a4306a6ee9efa82 100644
--- a/third_party/WebKit/public/platform/WebMediaConstraints.h
+++ b/third_party/WebKit/public/platform/WebMediaConstraints.h
@@ -230,23 +230,36 @@ private:
unsigned m_hasExact : 1;
};
+// This macro defines all the constraint names and their types.
+// The expansion of CONSTRAINT_ITEM will depend on context.
+#define CONSTRAINT_LIST \
+ CONSTRAINT_ITEM(width, Width, Long) \
+ CONSTRAINT_ITEM(height, Height, Long) \
+ CONSTRAINT_ITEM(aspectRatio, AspectRatio, Double) \
+ CONSTRAINT_ITEM(frameRate, FrameRate, Double) \
+ CONSTRAINT_ITEM(facingMode, FacingMode, String) \
+ CONSTRAINT_ITEM(volume, Volume, Double) \
+ CONSTRAINT_ITEM(sampleRate, SampleRate, Long) \
+ CONSTRAINT_ITEM(sampleSize, SampleSize, Long) \
+ CONSTRAINT_ITEM(echoCancellation, EchoCancellation, Boolean) \
+ CONSTRAINT_ITEM(latency, Latency, Double) \
+ CONSTRAINT_ITEM(channelCount, ChannelCount, Long) \
+ CONSTRAINT_ITEM(deviceId, DeviceId, String) \
+ CONSTRAINT_ITEM(groupId, GroupId, String)
+// End of list.
+
+
struct WebMediaTrackConstraintSet {
public:
BLINK_PLATFORM_EXPORT WebMediaTrackConstraintSet();
+ bool dummy; // added purely for init-call reasons
+#define CONSTRAINT_ITEM(lowercase, uppercase, datatype) \
+ datatype##Constraint lowercase;
+
+ CONSTRAINT_LIST
+
+#undef CONSTRAINT_ITEM
- LongConstraint width;
- LongConstraint height;
- DoubleConstraint aspectRatio;
- DoubleConstraint frameRate;
- StringConstraint facingMode;
- DoubleConstraint volume;
- LongConstraint sampleRate;
- LongConstraint sampleSize;
- BooleanConstraint echoCancellation;
- DoubleConstraint latency;
- LongConstraint channelCount;
- StringConstraint deviceId;
- StringConstraint groupId;
// Constraints not exposed in Blink at the moment, only through
// the legacy name interface.
StringConstraint mediaStreamSource; // tab, screen, desktop, system

Powered by Google App Engine
This is Rietveld 408576698