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

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

Issue 1225153002: Let WebRtcVideoChannel2::WebRtcVideoSendStream::InputFrame carry the input frame's timestamp to out… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Black frame timestamp Created 5 years, 5 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 | « talk/media/webrtc/webrtcvideoengine2.h ('k') | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/media/webrtc/webrtcvideoengine2.cc
diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc
index 0a2152e5e4c891494f34df4a271acb13aa3ec90f..9750fca665e8e76e41f52a9fad9b59174726ddb9 100644
--- a/talk/media/webrtc/webrtcvideoengine2.cc
+++ b/talk/media/webrtc/webrtcvideoengine2.cc
@@ -46,6 +46,7 @@
#include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
#include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h"
#include "webrtc/system_wrappers/interface/field_trial.h"
+#include "webrtc/system_wrappers/interface/tick_util.h"
#include "webrtc/system_wrappers/interface/trace_event.h"
#include "webrtc/video_decoder.h"
#include "webrtc/video_encoder.h"
@@ -1663,7 +1664,9 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::WebRtcVideoSendStream(
capturer_(NULL),
sending_(false),
muted_(false),
- old_adapt_changes_(0) {
+ old_adapt_changes_(0),
+ base_timestamp_ms_(0),
+ last_timestamp_ms_(0) {
parameters_.config.rtp.max_packet_size = kVideoMtu;
sp.GetPrimarySsrcs(&parameters_.config.rtp.ssrcs);
@@ -1727,6 +1730,15 @@ void WebRtcVideoChannel2::WebRtcVideoSendStream::InputFrame(
static_cast<int>(frame->GetWidth()),
static_cast<int>(frame->GetHeight()));
}
+
+ // frame->GetTimeStamp() is essentially a delta, align to webrtc time
+ if (base_timestamp_ms_ == 0) {
+ base_timestamp_ms_ = webrtc::TickTime::MillisecondTimestamp() -
+ frame->GetTimeStamp() / 1000000;
+ }
+
+ last_timestamp_ms_=base_timestamp_ms_ + frame->GetTimeStamp() / 1000000;
pbos-webrtc 2015/07/14 04:13:14 style (= -> " = "), run git cl format.
+ video_frame.set_render_time_ms(last_timestamp_ms_);
// Reconfigure codec if necessary.
SetDimensions(
video_frame.width(), video_frame.height(), capturer->IsScreencast());
@@ -1755,6 +1767,8 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer(
CreateBlackFrame(&black_frame, last_dimensions_.width,
last_dimensions_.height);
+
+ black_frame.set_render_time_ms(last_timestamp_ms_ + 1);
pbos-webrtc 2015/07/14 04:13:14 Add a comment here, I think.
stream_->Input()->IncomingCapturedFrame(black_frame);
}
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.h ('k') | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698