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

Unified Diff: webrtc/media/base/videocapturer.cc

Issue 1865283002: Use microsecond timestamp in cricket::VideoFrame. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Let VideoCapturer adjust timestamps. Created 4 years, 8 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: webrtc/media/base/videocapturer.cc
diff --git a/webrtc/media/base/videocapturer.cc b/webrtc/media/base/videocapturer.cc
index 94f65143531479ab5c9344034a030c8f7edcb501..f9712edd4cb369647695154fe11859b818611952 100644
--- a/webrtc/media/base/videocapturer.cc
+++ b/webrtc/media/base/videocapturer.cc
@@ -224,6 +224,18 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
return;
}
+ int64_t timestamp_us =
perkj_webrtc 2016/04/08 08:22:48 do this in the frame factory instead.
nisse-webrtc 2016/04/08 09:15:43 Moving the logic there makes sense, I'll give it a
+ captured_frame->time_stamp / rtc::kNumNanosecsPerMicrosec;
+
+ if (!timestamp_offset_valid_) {
+ timestamp_offset_ = rtc::TimeMicros() - timestamp_us;
+ timestamp_offset_valid_ = true;
+ }
+
+ // Add offset, to get time stamps with the same epoch as the
+ // system monotonic clock, rtc::TimeMicros().
+ timestamp_us += timestamp_offset_;
+
// Use a temporary buffer to scale
std::unique_ptr<uint8_t[]> scale_buffer;
if (IsScreencast()) {
@@ -396,6 +408,11 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
return;
}
+ // Overrides the timestamp set by the FrameFactory.
+ // TODO(nisse): Arrange to either get the FrameFactory to set the
+ // timestamp with correct offset, or not set the timestamp at all.
+ adapted_frame->set_timestamp_us(timestamp_us);
+
OnFrame(this, adapted_frame.get());
UpdateInputSize(captured_frame);
}

Powered by Google App Engine
This is Rietveld 408576698