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

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: Fallback Created 5 years, 1 month 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
« no previous file with comments | « media/base/mac/coremedia_glue.mm ('k') | media/capture/video/mac/video_capture_device_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..abbbeb75186ce6efc18f9dd6a2b1ac3ba13e0abb 100644
--- a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
+++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -5,6 +5,7 @@
#import "media/capture/video/mac/video_capture_device_avfoundation_mac.h"
#import <CoreVideo/CoreVideo.h>
+#import <CoreMedia/CoreMedia.h>
mcasas 2015/11/02 18:59:18 Imports, same as includes, should follow alphabeti
qiangchen 2015/11/02 21:35:47 Done.
#include "base/logging.h"
#include "base/mac/foundation_util.h"
@@ -328,9 +329,21 @@ didOutputSampleBuffer:(CoreMediaGlue::CMSampleBufferRef)sampleBuffer
{
base::AutoLock lock(lock_);
+ const CoreMediaGlue::CMTime cm_timestamp =
+ CoreMediaGlue::CMSampleBufferGetPresentationTimeStamp(sampleBuffer);
+ base::TimeTicks timestamp;
+ if ((cm_timestamp.flags & kCMTimeFlags_Valid) && cm_timestamp.timescale) {
mcasas 2015/11/02 18:59:18 What about const base::TimeTicks timestamp =
qiangchen 2015/11/02 21:35:47 Done. But not using CMTimeGetSeconds, because Cor
+ timestamp =
+ base::TimeTicks() +
+ base::TimeDelta::FromMicroseconds(
+ cm_timestamp.value * base::TimeTicks::kMicrosecondsPerSecond /
+ cm_timestamp.timescale);
+ } else {
+ timestamp = base::TimeTicks::Now();
+ }
if (frameReceiver_ && baseAddress) {
frameReceiver_->ReceiveFrame(reinterpret_cast<uint8_t*>(baseAddress),
- frameSize, captureFormat, 0, 0);
+ frameSize, captureFormat, 0, 0, timestamp);
}
}
« no previous file with comments | « media/base/mac/coremedia_glue.mm ('k') | media/capture/video/mac/video_capture_device_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698