| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/capture/video/win/video_capture_device_win.h" | 5 #include "media/capture/video/win/video_capture_device_win.h" |
| 6 | 6 |
| 7 #include <ks.h> | 7 #include <ks.h> |
| 8 #include <ksmedia.h> | 8 #include <ksmedia.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <list> | 11 #include <list> |
| 12 #include <utility> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/win/scoped_co_mem.h" | 16 #include "base/win/scoped_co_mem.h" |
| 16 #include "base/win/scoped_variant.h" | 17 #include "base/win/scoped_variant.h" |
| 17 | 18 |
| 18 using base::win::ScopedCoMem; | 19 using base::win::ScopedCoMem; |
| 19 using base::win::ScopedComPtr; | 20 using base::win::ScopedComPtr; |
| 20 using base::win::ScopedVariant; | 21 using base::win::ScopedVariant; |
| 21 | 22 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 return CreateCapabilityMap(); | 328 return CreateCapabilityMap(); |
| 328 } | 329 } |
| 329 | 330 |
| 330 void VideoCaptureDeviceWin::AllocateAndStart( | 331 void VideoCaptureDeviceWin::AllocateAndStart( |
| 331 const VideoCaptureParams& params, | 332 const VideoCaptureParams& params, |
| 332 scoped_ptr<VideoCaptureDevice::Client> client) { | 333 scoped_ptr<VideoCaptureDevice::Client> client) { |
| 333 DCHECK(thread_checker_.CalledOnValidThread()); | 334 DCHECK(thread_checker_.CalledOnValidThread()); |
| 334 if (state_ != kIdle) | 335 if (state_ != kIdle) |
| 335 return; | 336 return; |
| 336 | 337 |
| 337 client_ = client.Pass(); | 338 client_ = std::move(client); |
| 338 | 339 |
| 339 // Get the camera capability that best match the requested format. | 340 // Get the camera capability that best match the requested format. |
| 340 const CapabilityWin found_capability = | 341 const CapabilityWin found_capability = |
| 341 GetBestMatchedCapability(params.requested_format, capabilities_); | 342 GetBestMatchedCapability(params.requested_format, capabilities_); |
| 342 | 343 |
| 343 // Reduce the frame rate if the requested frame rate is lower | 344 // Reduce the frame rate if the requested frame rate is lower |
| 344 // than the capability. | 345 // than the capability. |
| 345 const float frame_rate = | 346 const float frame_rate = |
| 346 std::min(params.requested_format.frame_rate, | 347 std::min(params.requested_format.frame_rate, |
| 347 found_capability.supported_format.frame_rate); | 348 found_capability.supported_format.frame_rate); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 575 } |
| 575 | 576 |
| 576 void VideoCaptureDeviceWin::SetErrorState( | 577 void VideoCaptureDeviceWin::SetErrorState( |
| 577 const tracked_objects::Location& from_here, | 578 const tracked_objects::Location& from_here, |
| 578 const std::string& reason) { | 579 const std::string& reason) { |
| 579 DCHECK(thread_checker_.CalledOnValidThread()); | 580 DCHECK(thread_checker_.CalledOnValidThread()); |
| 580 state_ = kError; | 581 state_ = kError; |
| 581 client_->OnError(from_here, reason); | 582 client_->OnError(from_here, reason); |
| 582 } | 583 } |
| 583 } // namespace media | 584 } // namespace media |
| OLD | NEW |