Chromium Code Reviews| Index: media/capture/video/mac/video_capture_device_decklink_mac.mm |
| diff --git a/media/capture/video/mac/video_capture_device_decklink_mac.mm b/media/capture/video/mac/video_capture_device_decklink_mac.mm |
| index b075c4b234a28f790f63820a589398d4cb4619f4..0f598634938187b16148abe288e4fde055a8ad1b 100644 |
| --- a/media/capture/video/mac/video_capture_device_decklink_mac.mm |
| +++ b/media/capture/video/mac/video_capture_device_decklink_mac.mm |
| @@ -92,6 +92,8 @@ class DeckLinkCaptureDelegate |
| // |decklink_| represents a physical device attached to the host. |
| ScopedDeckLinkPtr<IDeckLink> decklink_; |
| + base::TimeTicks first_ref_time_; |
| + |
| // Checks for Device (a.k.a. Audio) thread. |
| base::ThreadChecker thread_checker_; |
| @@ -256,13 +258,24 @@ HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived( |
| gfx::Size(video_frame->GetWidth(), video_frame->GetHeight()), |
| 0.0f, // Frame rate is not needed for captured data callback. |
| pixel_format); |
| + base::TimeTicks now = base::TimeTicks::Now(); |
| base::AutoLock lock(lock_); |
| if (frame_receiver_) { |
| + const BMDTimeScale micros_time_scale = base::Time::kMicrosecondsPerSecond; |
| + BMDTimeValue frame_time; |
| + BMDTimeValue frame_duration; |
| + base::TimeDelta timestamp; |
| + if (SUCCEEDED(video_frame->GetStreamTime(&frame_time, &frame_duration, |
| + micros_time_scale))) { |
| + timestamp = base::TimeDelta::FromMicroseconds(frame_time); |
| + } else { |
| + timestamp = now - first_ref_time_; |
|
miu
2016/05/25 01:51:30
You're still going to need this code for this fall
qiangchen
2016/05/25 16:46:17
Done.
|
| + } |
| frame_receiver_->OnIncomingCapturedData( |
| video_data, video_frame->GetRowBytes() * video_frame->GetHeight(), |
| capture_format, |
| 0, // Rotation. |
| - base::TimeTicks::Now()); |
| + now, timestamp); |
| } |
| return S_OK; |
| } |
| @@ -451,11 +464,12 @@ void VideoCaptureDeviceDeckLinkMac::OnIncomingCapturedData( |
| size_t length, |
| const VideoCaptureFormat& frame_format, |
| int rotation, // Clockwise. |
| - base::TimeTicks timestamp) { |
| + base::TimeTicks reference_time, |
| + base::TimeDelta timestamp) { |
| base::AutoLock lock(lock_); |
| if (client_) { |
| client_->OnIncomingCapturedData(data, length, frame_format, rotation, |
| - timestamp); |
| + reference_time, timestamp); |
| } |
| } |