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

Unified Diff: media/capture/video/mac/video_capture_device_avfoundation_mac.mm

Issue 1421583007: Mac Video Capture: Sending the timestamps provided by the driver to the capture pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: media/capture/video/mac/video_capture_device_avfoundation_mac.mm
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
index deb14080cfd2f2cb16709c9dd473df7cd809d2fd..beb196ac6d76706a94d0a97196ca467eb3970ebb 100644
--- a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
+++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -328,9 +328,16 @@ didOutputSampleBuffer:(CoreMediaGlue::CMSampleBufferRef)sampleBuffer
{
base::AutoLock lock(lock_);
+ const int microseconds_per_second = 1000000;
mcasas 2015/10/31 03:24:25 Instead of |microseconds_per_second|, you should u
qiangchen 2015/11/02 18:21:21 Done.
+ CoreMediaGlue::CMTime cm_timestamp =
+ CoreMediaGlue::CMSampleBufferGetPresentationTimeStamp(sampleBuffer);
+ const base::TimeTicks timestamp =
mcasas 2015/10/31 03:24:25 At least DCHECK_NE(0, cm_timestamp.timescale);
qiangchen 2015/11/02 18:21:21 Did a fallback code path in case the timestamp is
+ base::TimeTicks() + base::TimeDelta::FromMicroseconds(
+ cm_timestamp.value * microseconds_per_second /
+ cm_timestamp.timescale);
if (frameReceiver_ && baseAddress) {
frameReceiver_->ReceiveFrame(reinterpret_cast<uint8_t*>(baseAddress),
- frameSize, captureFormat, 0, 0);
+ frameSize, captureFormat, 0, 0, timestamp);
}
}

Powered by Google App Engine
This is Rietveld 408576698