| 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> |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } | 416 } |
| 417 | 417 |
| 418 // Start capturing. | 418 // Start capturing. |
| 419 hr = media_control_->Run(); | 419 hr = media_control_->Run(); |
| 420 if (FAILED(hr)) { | 420 if (FAILED(hr)) { |
| 421 SetErrorState(FROM_HERE, "Failed to start the Capture device.", hr); | 421 SetErrorState(FROM_HERE, "Failed to start the Capture device.", hr); |
| 422 return; | 422 return; |
| 423 } | 423 } |
| 424 | 424 |
| 425 state_ = kCapturing; | 425 state_ = kCapturing; |
| 426 client_->OnStarted(); |
| 426 } | 427 } |
| 427 | 428 |
| 428 void VideoCaptureDeviceWin::StopAndDeAllocate() { | 429 void VideoCaptureDeviceWin::StopAndDeAllocate() { |
| 429 DCHECK(thread_checker_.CalledOnValidThread()); | 430 DCHECK(thread_checker_.CalledOnValidThread()); |
| 430 if (state_ != kCapturing) | 431 if (state_ != kCapturing) |
| 431 return; | 432 return; |
| 432 | 433 |
| 433 HRESULT hr = media_control_->Stop(); | 434 HRESULT hr = media_control_->Stop(); |
| 434 if (FAILED(hr)) { | 435 if (FAILED(hr)) { |
| 435 SetErrorState(FROM_HERE, "Failed to stop the capture graph.", hr); | 436 SetErrorState(FROM_HERE, "Failed to stop the capture graph.", hr); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 void VideoCaptureDeviceWin::SetErrorState( | 590 void VideoCaptureDeviceWin::SetErrorState( |
| 590 const tracked_objects::Location& from_here, | 591 const tracked_objects::Location& from_here, |
| 591 const std::string& reason, | 592 const std::string& reason, |
| 592 HRESULT hr) { | 593 HRESULT hr) { |
| 593 DCHECK(thread_checker_.CalledOnValidThread()); | 594 DCHECK(thread_checker_.CalledOnValidThread()); |
| 594 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); | 595 DLOG_IF_FAILED_WITH_HRESULT(reason, hr); |
| 595 state_ = kError; | 596 state_ = kError; |
| 596 client_->OnError(from_here, reason); | 597 client_->OnError(from_here, reason); |
| 597 } | 598 } |
| 598 } // namespace media | 599 } // namespace media |
| OLD | NEW |