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..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); |
| } |
| } |