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

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: Remove SendStream after unit test 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
Index: talk/media/webrtc/webrtcvideoengine2.cc
diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc
index 0a2152e5e4c891494f34df4a271acb13aa3ec90f..10fa54d04c2c97fdb3956149ae172103b3c16261 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;
+ video_frame.set_render_time_ms(last_timestamp_ms_);
pthatcher1 2015/07/14 17:57:28 I think this would be more clear if you put "frame
qiangchen 2015/07/14 22:04:26 Done.
// Reconfigure codec if necessary.
SetDimensions(
video_frame.width(), video_frame.height(), capturer->IsScreencast());
@@ -1755,6 +1767,10 @@ bool WebRtcVideoChannel2::WebRtcVideoSendStream::SetCapturer(
CreateBlackFrame(&black_frame, last_dimensions_.width,
last_dimensions_.height);
+
+ // Force this black frame not to be dropped due to timestamp order
+ // check.
pthatcher1 2015/07/14 17:57:28 Can you explain a little more how adding "+ 1" acc
qiangchen 2015/07/14 22:04:26 Done. Add 1 could bypass the timestamp check in In
+ black_frame.set_render_time_ms(last_timestamp_ms_ + 1);
stream_->Input()->IncomingCapturedFrame(black_frame);
}

Powered by Google App Engine
This is Rietveld 408576698