Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: media/video/capture/win/video_capture_device_mf_win.cc

Issue 101843005: Convert video capture pipline to base::TimeTicks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 9890509b Rebase, Windows compile fixes Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return 1U; 197 return 1U;
198 } 198 }
199 199
200 STDMETHOD_(ULONG, Release)() { 200 STDMETHOD_(ULONG, Release)() {
201 base::RefCountedThreadSafe<MFReaderCallback>::Release(); 201 base::RefCountedThreadSafe<MFReaderCallback>::Release();
202 return 1U; 202 return 1U;
203 } 203 }
204 204
205 STDMETHOD(OnReadSample)(HRESULT status, DWORD stream_index, 205 STDMETHOD(OnReadSample)(HRESULT status, DWORD stream_index,
206 DWORD stream_flags, LONGLONG time_stamp, IMFSample* sample) { 206 DWORD stream_flags, LONGLONG time_stamp, IMFSample* sample) {
207 base::Time stamp(base::Time::Now()); 207 base::TimeTicks stamp(base::TimeTicks::Now());
208 if (!sample) { 208 if (!sample) {
209 observer_->OnIncomingCapturedFrame(NULL, 0, stamp, 0); 209 observer_->OnIncomingCapturedFrame(NULL, 0, stamp, 0);
210 return S_OK; 210 return S_OK;
211 } 211 }
212 212
213 DWORD count = 0; 213 DWORD count = 0;
214 sample->GetBufferCount(&count); 214 sample->GetBufferCount(&count);
215 215
216 for (DWORD i = 0; i < count; ++i) { 216 for (DWORD i = 0; i < count; ++i) {
217 ScopedComPtr<IMFMediaBuffer> buffer; 217 ScopedComPtr<IMFMediaBuffer> buffer;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // TODO(tommi): Hook up the IMFMediaEventGenerator notifications API and 400 // TODO(tommi): Hook up the IMFMediaEventGenerator notifications API and
401 // do not wait at all after getting MEVideoCaptureDeviceRemoved event. 401 // do not wait at all after getting MEVideoCaptureDeviceRemoved event.
402 // See issue/226396. 402 // See issue/226396.
403 if (wait) 403 if (wait)
404 flushed.TimedWait(base::TimeDelta::FromMilliseconds(kFlushTimeOutInMs)); 404 flushed.TimedWait(base::TimeDelta::FromMilliseconds(kFlushTimeOutInMs));
405 } 405 }
406 406
407 void VideoCaptureDeviceMFWin::OnIncomingCapturedFrame( 407 void VideoCaptureDeviceMFWin::OnIncomingCapturedFrame(
408 const uint8* data, 408 const uint8* data,
409 int length, 409 int length,
410 const base::Time& time_stamp, 410 const base::TimeTicks& time_stamp,
411 int rotation) { 411 int rotation) {
412 base::AutoLock lock(lock_); 412 base::AutoLock lock(lock_);
413 if (data && client_.get()) 413 if (data && client_.get())
414 client_->OnIncomingCapturedFrame(data, 414 client_->OnIncomingCapturedFrame(data,
415 length, 415 length,
416 time_stamp, 416 time_stamp,
417 rotation, 417 rotation,
418 capture_format_); 418 capture_format_);
419 419
420 if (capture_) { 420 if (capture_) {
(...skipping 10 matching lines...) Expand all
431 } 431 }
432 } 432 }
433 433
434 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) { 434 void VideoCaptureDeviceMFWin::OnError(HRESULT hr) {
435 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr; 435 DLOG(ERROR) << "VideoCaptureDeviceMFWin: " << std::hex << hr;
436 if (client_.get()) 436 if (client_.get())
437 client_->OnError(); 437 client_->OnError();
438 } 438 }
439 439
440 } // namespace media 440 } // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/win/video_capture_device_mf_win.h ('k') | media/video/capture/win/video_capture_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698