| 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_mf_win.h" | 5 #include "media/capture/video/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 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 OnError(FROM_HERE, hr); | 271 OnError(FROM_HERE, hr); |
| 272 } | 272 } |
| 273 | 273 |
| 274 void VideoCaptureDeviceMFWin::StopAndDeAllocate() { | 274 void VideoCaptureDeviceMFWin::StopAndDeAllocate() { |
| 275 DCHECK(CalledOnValidThread()); | 275 DCHECK(CalledOnValidThread()); |
| 276 base::WaitableEvent flushed(false, false); | 276 base::WaitableEvent flushed(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 277 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 277 const int kFlushTimeOutInMs = 1000; | 278 const int kFlushTimeOutInMs = 1000; |
| 278 bool wait = false; | 279 bool wait = false; |
| 279 { | 280 { |
| 280 base::AutoLock lock(lock_); | 281 base::AutoLock lock(lock_); |
| 281 if (capture_) { | 282 if (capture_) { |
| 282 capture_ = false; | 283 capture_ = false; |
| 283 callback_->SetSignalOnFlush(&flushed); | 284 callback_->SetSignalOnFlush(&flushed); |
| 284 wait = SUCCEEDED( | 285 wait = SUCCEEDED( |
| 285 reader_->Flush(static_cast<DWORD>(MF_SOURCE_READER_ALL_STREAMS))); | 286 reader_->Flush(static_cast<DWORD>(MF_SOURCE_READER_ALL_STREAMS))); |
| 286 if (!wait) { | 287 if (!wait) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 HRESULT hr) { | 331 HRESULT hr) { |
| 331 if (client_.get()) { | 332 if (client_.get()) { |
| 332 client_->OnError( | 333 client_->OnError( |
| 333 from_here, | 334 from_here, |
| 334 base::StringPrintf("VideoCaptureDeviceMFWin: %s", | 335 base::StringPrintf("VideoCaptureDeviceMFWin: %s", |
| 335 logging::SystemErrorCodeToString(hr).c_str())); | 336 logging::SystemErrorCodeToString(hr).c_str())); |
| 336 } | 337 } |
| 337 } | 338 } |
| 338 | 339 |
| 339 } // namespace media | 340 } // namespace media |
| OLD | NEW |