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

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

Issue 2922013002: Update constraints processing for video content capture. (Closed)
Patch Set: Rebase Created 3 years, 6 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
« no previous file with comments | « no previous file | content/renderer/media/media_stream_constraints_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/logging.h" 10 #include "base/logging.h"
(...skipping 29 matching lines...) Expand all
40 // the adapter settings suitable for the track the constraints are being 40 // the adapter settings suitable for the track the constraints are being
41 // to. These settings are derived from the width, height, aspectRatio and 41 // to. These settings are derived from the width, height, aspectRatio and
42 // frameRate constraints. 42 // frameRate constraints.
43 // Some MediaStreamVideoSink objects (e.g. MediaStreamVideoWebRtcSink) require 43 // Some MediaStreamVideoSink objects (e.g. MediaStreamVideoWebRtcSink) require
44 // configuration derived from constraints that cannot be obtained from the 44 // configuration derived from constraints that cannot be obtained from the
45 // source and track settings indicated above. The following fields are used 45 // source and track settings indicated above. The following fields are used
46 // to configure sinks: 46 // to configure sinks:
47 // * noise_reduction: used to control noise reduction for a screen-capture 47 // * noise_reduction: used to control noise reduction for a screen-capture
48 // track sent to a peer connection. Derive from the googNoiseReduction 48 // track sent to a peer connection. Derive from the googNoiseReduction
49 // constraint. 49 // constraint.
50 // * min_frame_rate: used to control frame refreshes in screen-capture tracks 50 // * min_frame_rate and max_frame_rate: used to control frame refreshes in
51 // sent to a peer connection. Derived from the frameRate constraint. 51 // screen-capture tracks sent to a peer connection. Derived from the
52 // frameRate constraint.
52 class CONTENT_EXPORT VideoCaptureSettings { 53 class CONTENT_EXPORT VideoCaptureSettings {
53 public: 54 public:
54 // Creates an object without value and with an empty failed constraint name. 55 // Creates an object without value and with an empty failed constraint name.
55 VideoCaptureSettings(); 56 VideoCaptureSettings();
56 57
57 // Creates an object without value and with the given 58 // Creates an object without value and with the given
58 // |failed_constraint_name|. Does not take ownership of 59 // |failed_constraint_name|. Does not take ownership of
59 // |failed_constraint_name|, so it must be null or point to a string that 60 // |failed_constraint_name|, so it must be null or point to a string that
60 // remains accessible. 61 // remains accessible.
61 explicit VideoCaptureSettings(const char* failed_constraint_name); 62 explicit VideoCaptureSettings(const char* failed_constraint_name);
62 63
63 // Creates an object with the given values. 64 // Creates an object with the given values.
64 VideoCaptureSettings(std::string device_id, 65 VideoCaptureSettings(std::string device_id,
65 media::VideoCaptureParams capture_params_, 66 media::VideoCaptureParams capture_params_,
66 base::Optional<bool> noise_reduction_, 67 base::Optional<bool> noise_reduction_,
67 const VideoTrackAdapterSettings& track_adapter_settings, 68 const VideoTrackAdapterSettings& track_adapter_settings,
68 double min_frame_rate); 69 base::Optional<double> min_frame_rate,
70 base::Optional<double> max_frame_rate);
69 71
70 VideoCaptureSettings(const VideoCaptureSettings& other); 72 VideoCaptureSettings(const VideoCaptureSettings& other);
71 VideoCaptureSettings& operator=(const VideoCaptureSettings& other); 73 VideoCaptureSettings& operator=(const VideoCaptureSettings& other);
72 VideoCaptureSettings(VideoCaptureSettings&& other); 74 VideoCaptureSettings(VideoCaptureSettings&& other);
73 VideoCaptureSettings& operator=(VideoCaptureSettings&& other); 75 VideoCaptureSettings& operator=(VideoCaptureSettings&& other);
74 ~VideoCaptureSettings(); 76 ~VideoCaptureSettings();
75 77
76 bool HasValue() const { return failed_constraint_name_ == nullptr; } 78 bool HasValue() const { return failed_constraint_name_ == nullptr; }
77 79
78 // Convenience accessors for fields embedded in |capture_params_|. 80 // Convenience accessors for fields embedded in |capture_params_|.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return capture_params_; 114 return capture_params_;
113 } 115 }
114 const base::Optional<bool>& noise_reduction() const { 116 const base::Optional<bool>& noise_reduction() const {
115 DCHECK(HasValue()); 117 DCHECK(HasValue());
116 return noise_reduction_; 118 return noise_reduction_;
117 } 119 }
118 const VideoTrackAdapterSettings& track_adapter_settings() const { 120 const VideoTrackAdapterSettings& track_adapter_settings() const {
119 DCHECK(HasValue()); 121 DCHECK(HasValue());
120 return track_adapter_settings_; 122 return track_adapter_settings_;
121 } 123 }
122 double min_frame_rate() const { 124 const base::Optional<double>& min_frame_rate() const {
123 DCHECK(HasValue()); 125 DCHECK(HasValue());
124 return min_frame_rate_; 126 return min_frame_rate_;
125 } 127 }
128 const base::Optional<double>& max_frame_rate() const {
129 DCHECK(HasValue());
130 return max_frame_rate_;
131 }
126 132
127 private: 133 private:
128 const char* failed_constraint_name_; 134 const char* failed_constraint_name_;
129 std::string device_id_; 135 std::string device_id_;
130 media::VideoCaptureParams capture_params_; 136 media::VideoCaptureParams capture_params_;
131 base::Optional<bool> noise_reduction_; 137 base::Optional<bool> noise_reduction_;
132 VideoTrackAdapterSettings track_adapter_settings_; 138 VideoTrackAdapterSettings track_adapter_settings_;
133 double min_frame_rate_; 139 base::Optional<double> min_frame_rate_;
140 base::Optional<double> max_frame_rate_;
134 }; 141 };
135 142
136 // Method to get boolean value of constraint with |name| from constraints. 143 // Method to get boolean value of constraint with |name| from constraints.
137 // Returns true if the constraint is specified in either mandatory or optional 144 // Returns true if the constraint is specified in either mandatory or optional
138 // constraints. 145 // constraints.
139 bool CONTENT_EXPORT GetConstraintValueAsBoolean( 146 bool CONTENT_EXPORT GetConstraintValueAsBoolean(
140 const blink::WebMediaConstraints& constraints, 147 const blink::WebMediaConstraints& constraints,
141 const blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker, 148 const blink::BooleanConstraint blink::WebMediaTrackConstraintSet::*picker,
142 bool* value); 149 bool* value);
143 150
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 VideoTrackAdapterSettings CONTENT_EXPORT SelectVideoTrackAdapterSettings( 245 VideoTrackAdapterSettings CONTENT_EXPORT SelectVideoTrackAdapterSettings(
239 const blink::WebMediaTrackConstraintSet& basic_constraint_set, 246 const blink::WebMediaTrackConstraintSet& basic_constraint_set,
240 const ResolutionSet& resolution_set, 247 const ResolutionSet& resolution_set,
241 const NumericRangeSet<double>& frame_rate_set, 248 const NumericRangeSet<double>& frame_rate_set,
242 const media::VideoCaptureFormat& source_format, 249 const media::VideoCaptureFormat& source_format,
243 bool expect_source_native_size); 250 bool expect_source_native_size);
244 251
245 } // namespace content 252 } // namespace content
246 253
247 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_ 254 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_constraints_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698