Chromium Code Reviews| 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); |
| } |
| } |