| OLD | NEW |
| 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_content.h" | 5 #include "content/renderer/media/media_stream_constraints_util_video_content.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 : media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT; | 336 : media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT; |
| 337 | 337 |
| 338 media::VideoCaptureParams capture_params = | 338 media::VideoCaptureParams capture_params = |
| 339 SelectVideoCaptureParamsFromCandidates( | 339 SelectVideoCaptureParamsFromCandidates( |
| 340 candidates, basic_constraint_set, default_height, default_width, | 340 candidates, basic_constraint_set, default_height, default_width, |
| 341 default_frame_rate, default_resolution_policy); | 341 default_frame_rate, default_resolution_policy); |
| 342 | 342 |
| 343 base::Optional<bool> noise_reduction = SelectNoiseReductionFromCandidates( | 343 base::Optional<bool> noise_reduction = SelectNoiseReductionFromCandidates( |
| 344 candidates.noise_reduction_set(), basic_constraint_set); | 344 candidates.noise_reduction_set(), basic_constraint_set); |
| 345 | 345 |
| 346 // Using false because the resolution policy for content capture can produce |
| 347 // frames in various sizes. |
| 348 bool expect_source_native_size = false; |
| 346 auto track_adapter_settings = SelectVideoTrackAdapterSettings( | 349 auto track_adapter_settings = SelectVideoTrackAdapterSettings( |
| 347 basic_constraint_set, candidates.resolution_set(), | 350 basic_constraint_set, candidates.resolution_set(), |
| 348 candidates.frame_rate_set(), capture_params.requested_format); | 351 candidates.frame_rate_set(), capture_params.requested_format, |
| 352 expect_source_native_size); |
| 349 | 353 |
| 350 return VideoCaptureSettings(std::move(device_id), capture_params, | 354 return VideoCaptureSettings(std::move(device_id), capture_params, |
| 351 noise_reduction, track_adapter_settings, | 355 noise_reduction, track_adapter_settings, |
| 352 candidates.frame_rate_set().Min()); | 356 candidates.frame_rate_set().Min()); |
| 353 } | 357 } |
| 354 | 358 |
| 355 VideoCaptureSettings UnsatisfiedConstraintsResult( | 359 VideoCaptureSettings UnsatisfiedConstraintsResult( |
| 356 const VideoContentCaptureCandidates& candidates, | 360 const VideoContentCaptureCandidates& candidates, |
| 357 const blink::WebMediaTrackConstraintSet& constraint_set) { | 361 const blink::WebMediaTrackConstraintSet& constraint_set) { |
| 358 DCHECK(candidates.IsEmpty()); | 362 DCHECK(candidates.IsEmpty()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 if (!intersection.IsEmpty()) | 400 if (!intersection.IsEmpty()) |
| 397 candidates = std::move(intersection); | 401 candidates = std::move(intersection); |
| 398 } | 402 } |
| 399 | 403 |
| 400 DCHECK(!candidates.IsEmpty()); | 404 DCHECK(!candidates.IsEmpty()); |
| 401 return SelectResultFromCandidates(candidates, constraints.Basic(), | 405 return SelectResultFromCandidates(candidates, constraints.Basic(), |
| 402 stream_source); | 406 stream_source); |
| 403 } | 407 } |
| 404 | 408 |
| 405 } // namespace content | 409 } // namespace content |
| OLD | NEW |