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

Side by Side Diff: content/renderer/media/media_stream_constraints_util.h

Issue 2707203006: Minor refactoring of support classes for video-device constraints. (Closed)
Patch Set: hbos comment + fix in accessor Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // constraints. 62 // constraints.
63 bool CONTENT_EXPORT GetConstraintValueAsString( 63 bool CONTENT_EXPORT GetConstraintValueAsString(
64 const blink::WebMediaConstraints& constraints, 64 const blink::WebMediaConstraints& constraints,
65 const blink::StringConstraint blink::WebMediaTrackConstraintSet::*picker, 65 const blink::StringConstraint blink::WebMediaTrackConstraintSet::*picker,
66 std::string* value); 66 std::string* value);
67 67
68 rtc::Optional<bool> ConstraintToOptional( 68 rtc::Optional<bool> ConstraintToOptional(
69 const blink::WebMediaConstraints& constraints, 69 const blink::WebMediaConstraints& constraints,
70 const blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker); 70 const blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker);
71 71
72 template <typename ConstraintType>
73 bool ConstraintHasMax(const ConstraintType& constraint) {
74 return constraint.hasMax() || constraint.hasExact();
75 }
76
77 template <typename ConstraintType>
78 bool ConstraintHasMin(const ConstraintType& constraint) {
79 return constraint.hasMin() || constraint.hasExact();
80 }
81
82 template <typename ConstraintType>
83 auto ConstraintMax(const ConstraintType& constraint)
84 -> decltype(constraint.max()) {
85 DCHECK(ConstraintHasMax(constraint));
86 return constraint.hasExact() ? constraint.exact() : constraint.max();
87 }
88
89 template <typename ConstraintType>
90 auto ConstraintMin(const ConstraintType& constraint)
91 -> decltype(constraint.min()) {
92 DCHECK(ConstraintHasMin(constraint));
93 return constraint.hasExact() ? constraint.exact() : constraint.min();
94 }
95
72 } // namespace content 96 } // namespace content
73 97
74 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ 98 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_
OLDNEW
« no previous file with comments | « content/renderer/BUILD.gn ('k') | content/renderer/media/media_stream_constraints_util_video_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698