| 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/video/capture/win/video_capture_device_mf_win.h" | 5 #include "media/video/capture/win/video_capture_device_mf_win.h" |
| 6 | 6 |
| 7 #include <mfapi.h> | 7 #include <mfapi.h> |
| 8 #include <mferror.h> | 8 #include <mferror.h> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 void VideoCaptureDeviceMFWin::OnIncomingCapturedFrame( | 412 void VideoCaptureDeviceMFWin::OnIncomingCapturedFrame( |
| 413 const uint8* data, | 413 const uint8* data, |
| 414 int length, | 414 int length, |
| 415 const base::Time& time_stamp, | 415 const base::Time& time_stamp, |
| 416 int rotation, | 416 int rotation, |
| 417 bool flip_vert, | 417 bool flip_vert, |
| 418 bool flip_horiz) { | 418 bool flip_horiz) { |
| 419 base::AutoLock lock(lock_); | 419 base::AutoLock lock(lock_); |
| 420 if (data && client_.get()) | 420 if (data && client_.get()) |
| 421 client_->OnIncomingCapturedFrame(data, length, time_stamp, | 421 client_->OnIncomingCapturedFrame(data, |
| 422 rotation, flip_vert, flip_horiz, | 422 length, |
| 423 time_stamp, |
| 424 rotation, |
| 425 flip_vert, |
| 426 flip_horiz, |
| 423 current_setting_); | 427 current_setting_); |
| 424 | 428 |
| 425 if (capture_) { | 429 if (capture_) { |
| 426 HRESULT hr = reader_->ReadSample(MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, | 430 HRESULT hr = reader_->ReadSample(MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, |
| 427 NULL, NULL, NULL, NULL); | 431 NULL, NULL, NULL, NULL); |
| 428 if (FAILED(hr)) { | 432 if (FAILED(hr)) { |
| 429 // If running the *VideoCap* unit tests on repeat, this can sometimes | 433 // If running the *VideoCap* unit tests on repeat, this can sometimes |
| 430 // fail with HRESULT_FROM_WINHRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION). | 434 // fail with HRESULT_FROM_WINHRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION). |
| 431 // It's not clear to me why this is, but it is possible that it has | 435 // It's not clear to me why this is, but it is possible that it has |
| 432 // something to do with this bug: | 436 // something to do with this bug: |
| 433 // http://support.microsoft.com/kb/979567 | 437 // http://support.microsoft.com/kb/979567 |
| 434 OnError(hr); | 438 OnError(hr); |
| 435 } | 439 } |
| 436 } | 440 } |
| 437 } | 441 } |
| 438 | 442 |
| 439 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { | 443 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { |
| 440 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; | 444 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; |
| 441 if (client_.get()) | 445 if (client_.get()) |
| 442 client_->OnError(); | 446 client_->OnError(); |
| 443 } | 447 } |
| 444 | 448 |
| 445 } // namespace media | 449 } // namespace media |
| OLD | NEW |