Index: webrtc/api/mediaconstraintsinterface.cc |
diff --git a/webrtc/api/mediaconstraintsinterface.cc b/webrtc/api/mediaconstraintsinterface.cc |
index 51521946f6674ff5d0aa5647ab465fd7f758f973..66a32605713beb1e369711e49dc67cc568b4d02e 100644 |
--- a/webrtc/api/mediaconstraintsinterface.cc |
+++ b/webrtc/api/mediaconstraintsinterface.cc |
@@ -129,4 +129,24 @@ bool FindConstraint(const MediaConstraintsInterface* constraints, |
return false; |
} |
+// As above, but for integers. |
+bool FindConstraint(const MediaConstraintsInterface* constraints, |
+ const std::string& key, |
+ int* value, |
+ size_t* mandatory_constraints) { |
+ std::string string_value; |
+ if (!constraints) { |
+ return false; |
+ } |
+ if (constraints->GetMandatory().FindFirst(key, &string_value)) { |
+ if (mandatory_constraints) |
+ ++*mandatory_constraints; |
+ return rtc::FromString(string_value, value); |
+ } |
+ if (constraints->GetOptional().FindFirst(key, &string_value)) { |
+ return rtc::FromString(string_value, value); |
+ } |
+ return false; |
+} |
+ |
} // namespace webrtc |