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

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

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
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 #include "content/renderer/media/media_stream_constraints_util.h" 5 #include "content/renderer/media/media_stream_constraints_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 VideoCaptureSettings::VideoCaptureSettings() : VideoCaptureSettings("") {} 104 VideoCaptureSettings::VideoCaptureSettings() : VideoCaptureSettings("") {}
105 105
106 VideoCaptureSettings::VideoCaptureSettings(const char* failed_constraint_name) 106 VideoCaptureSettings::VideoCaptureSettings(const char* failed_constraint_name)
107 : failed_constraint_name_(failed_constraint_name) {} 107 : failed_constraint_name_(failed_constraint_name) {}
108 108
109 VideoCaptureSettings::VideoCaptureSettings( 109 VideoCaptureSettings::VideoCaptureSettings(
110 std::string device_id, 110 std::string device_id,
111 media::VideoCaptureParams capture_params, 111 media::VideoCaptureParams capture_params,
112 base::Optional<bool> noise_reduction, 112 base::Optional<bool> noise_reduction,
113 const VideoTrackAdapterSettings& track_adapter_settings, 113 const VideoTrackAdapterSettings& track_adapter_settings,
114 double min_frame_rate) 114 base::Optional<double> min_frame_rate,
115 base::Optional<double> max_frame_rate)
115 : failed_constraint_name_(nullptr), 116 : failed_constraint_name_(nullptr),
116 device_id_(std::move(device_id)), 117 device_id_(std::move(device_id)),
117 capture_params_(capture_params), 118 capture_params_(capture_params),
118 noise_reduction_(noise_reduction), 119 noise_reduction_(noise_reduction),
119 track_adapter_settings_(track_adapter_settings), 120 track_adapter_settings_(track_adapter_settings),
120 min_frame_rate_(min_frame_rate) { 121 min_frame_rate_(min_frame_rate),
121 DCHECK_LE(min_frame_rate_, capture_params.requested_format.frame_rate); 122 max_frame_rate_(max_frame_rate) {
123 DCHECK(!min_frame_rate ||
124 *min_frame_rate_ <= capture_params.requested_format.frame_rate);
122 DCHECK_LE(track_adapter_settings.max_width, 125 DCHECK_LE(track_adapter_settings.max_width,
123 capture_params.requested_format.frame_size.width()); 126 capture_params.requested_format.frame_size.width());
124 DCHECK_LE(track_adapter_settings.max_height, 127 DCHECK_LE(track_adapter_settings.max_height,
125 capture_params.requested_format.frame_size.height()); 128 capture_params.requested_format.frame_size.height());
126 DCHECK_LT(track_adapter_settings.max_frame_rate, 129 DCHECK_LT(track_adapter_settings.max_frame_rate,
127 capture_params.requested_format.frame_rate); 130 capture_params.requested_format.frame_rate);
128 } 131 }
129 132
130 VideoCaptureSettings::VideoCaptureSettings(const VideoCaptureSettings& other) = 133 VideoCaptureSettings::VideoCaptureSettings(const VideoCaptureSettings& other) =
131 default; 134 default;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 base::Optional<gfx::Size> expected_native_size; 244 base::Optional<gfx::Size> expected_native_size;
242 if (expect_source_native_size) 245 if (expect_source_native_size)
243 expected_native_size = source_format.frame_size; 246 expected_native_size = source_format.frame_size;
244 247
245 return VideoTrackAdapterSettings( 248 return VideoTrackAdapterSettings(
246 track_max_width, track_max_height, track_min_aspect_ratio, 249 track_max_width, track_max_height, track_min_aspect_ratio,
247 track_max_aspect_ratio, track_max_frame_rate, expected_native_size); 250 track_max_aspect_ratio, track_max_frame_rate, expected_native_size);
248 } 251 }
249 252
250 } // namespace content 253 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698