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

Unified Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 1865283002: Use microsecond timestamp in cricket::VideoFrame. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Delete debug logging. Formatting tweaks. 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/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index ec6b033d2f7a3862be69a9c25390d646968cfd2c..0471870e52045c4aa8149dcb7e90e42e089b9596 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -1514,7 +1514,7 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
pending_encoder_reconfiguration_(false),
allocated_encoder_(nullptr, webrtc::kVideoCodecUnknown, false),
sending_(false),
- first_frame_timestamp_ms_(0),
+ first_frame_timestamp_valid_(false),
perkj_webrtc 2016/04/13 05:57:06 why this change?
nisse-webrtc 2016/04/13 06:54:50 Zero is a valid timestamp offset, we need a separa
pbos-webrtc 2016/04/13 09:56:24 Sounds like we should use rtc::Optional then, or a
nisse-webrtc 2016/04/13 11:30:47 Done. Is it correct to rely on the default constru
last_frame_timestamp_ms_(0) {
parameters_.config.rtp.max_packet_size = kVideoMtu;
parameters_.conference_mode = send_params.conference_mode;
@@ -1573,12 +1573,15 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame(
}
int64_t frame_delta_ms = frame.GetTimeStamp() / rtc::kNumNanosecsPerMillisec;
+
// frame->GetTimeStamp() is essentially a delta, align to webrtc time
- if (first_frame_timestamp_ms_ == 0) {
+ if (!first_frame_timestamp_valid_) {
first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms;
+ first_frame_timestamp_valid_ = true;
}
last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms;
+
video_frame.set_render_time_ms(last_frame_timestamp_ms_);
// Reconfigure codec if necessary.
SetDimensions(video_frame.width(), video_frame.height());
@@ -1608,7 +1611,7 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::SetSource(
// Reset timestamps to realign new incoming frames to a webrtc timestamp. A
// new capturer may have a different timestamp delta than the previous one.
- first_frame_timestamp_ms_ = 0;
+ first_frame_timestamp_valid_ = false;
if (source == NULL) {
if (stream_ != NULL) {

Powered by Google App Engine
This is Rietveld 408576698