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

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

Issue 2870413004: Detect frames from rotated devices in VideoTrackAdapter on Android. (Closed)
Patch Set: address comment by tommi@ Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_video_device.h" 5 #include "content/renderer/media/media_stream_constraints_util_video_device.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 NumericRangeSet<double> constrained_frame_rate_; 168 NumericRangeSet<double> constrained_frame_rate_;
169 }; 169 };
170 170
171 VideoCaptureSettings ComputeVideoDeviceCaptureSettings( 171 VideoCaptureSettings ComputeVideoDeviceCaptureSettings(
172 const Candidate& candidate, 172 const Candidate& candidate,
173 const ConstrainedFormat& constrained_format, 173 const ConstrainedFormat& constrained_format,
174 const blink::WebMediaTrackConstraintSet& basic_constraint_set) { 174 const blink::WebMediaTrackConstraintSet& basic_constraint_set) {
175 media::VideoCaptureParams capture_params; 175 media::VideoCaptureParams capture_params;
176 capture_params.requested_format = candidate.format(); 176 capture_params.requested_format = candidate.format();
177 capture_params.power_line_frequency = candidate.power_line_frequency(); 177 capture_params.power_line_frequency = candidate.power_line_frequency();
178 // With device capture, incoming frames are expected to have the size
179 // specified in the requested capture format.
180 bool expect_source_native_size = true;
178 auto track_adapter_settings = SelectVideoTrackAdapterSettings( 181 auto track_adapter_settings = SelectVideoTrackAdapterSettings(
179 basic_constraint_set, constrained_format.constrained_resolution(), 182 basic_constraint_set, constrained_format.constrained_resolution(),
180 constrained_format.constrained_frame_rate(), 183 constrained_format.constrained_frame_rate(),
181 capture_params.requested_format); 184 capture_params.requested_format, expect_source_native_size);
182 185
183 return VideoCaptureSettings( 186 return VideoCaptureSettings(
184 candidate.device_id(), capture_params, candidate.noise_reduction(), 187 candidate.device_id(), capture_params, candidate.noise_reduction(),
185 track_adapter_settings, 188 track_adapter_settings,
186 constrained_format.constrained_frame_rate().Min()); 189 constrained_format.constrained_frame_rate().Min());
187 } 190 }
188 191
189 // Generic distance function between two numeric values. Based on the fitness 192 // Generic distance function between two numeric values. Based on the fitness
190 // distance function described in 193 // distance function described in
191 // https://w3c.github.io/mediacapture-main/#dfn-fitness-distance 194 // https://w3c.github.io/mediacapture-main/#dfn-fitness-distance
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 } 878 }
876 } 879 }
877 880
878 if (!result.HasValue()) 881 if (!result.HasValue())
879 return VideoCaptureSettings(failed_constraint_name); 882 return VideoCaptureSettings(failed_constraint_name);
880 883
881 return result; 884 return result;
882 } 885 }
883 886
884 } // namespace content 887 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698