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

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: Add missing override, intending to reland. 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index ae727812ad41dd174e25b7482346e87bdc3a4559..b593027dbc099b14cf7c25339cf0ec9c5a55695f 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -1524,7 +1524,6 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
pending_encoder_reconfiguration_(false),
allocated_encoder_(nullptr, webrtc::kVideoCodecUnknown, false),
sending_(false),
- first_frame_timestamp_ms_(0),
last_frame_timestamp_ms_(0) {
parameters_.config.rtp.max_packet_size = kVideoMtu;
parameters_.conference_mode = send_params.conference_mode;
@@ -1583,12 +1582,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) {
- first_frame_timestamp_ms_ = rtc::Time() - frame_delta_ms;
+ if (!first_frame_timestamp_ms_) {
+ first_frame_timestamp_ms_ =
+ rtc::Optional<int64_t>(rtc::Time() - frame_delta_ms);
}
- last_frame_timestamp_ms_ = first_frame_timestamp_ms_ + frame_delta_ms;
+ 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());
@@ -1618,7 +1620,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_ms_ = rtc::Optional<int64_t>();
if (source == NULL) {
if (stream_ != NULL) {
@@ -2402,8 +2404,8 @@ void WebRtcVideoChannel2::WebRtcVideoReceiveStream::OnFrame(
last_height_ = frame.height();
const WebRtcVideoFrame render_frame(
- frame.video_frame_buffer(),
- frame.render_time_ms() * rtc::kNumNanosecsPerMillisec, frame.rotation());
+ frame.video_frame_buffer(), frame.rotation(),
+ frame.render_time_ms() * rtc::kNumNanosecsPerMicrosec);
sink_->OnFrame(render_frame);
}
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698