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

Unified Diff: webrtc/video/video_receive_stream.cc

Issue 2993793002: Request keyframes more frequently on stream start/decoding error. (Closed)
Patch Set: Created 3 years, 4 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/video/video_receive_stream.cc
diff --git a/webrtc/video/video_receive_stream.cc b/webrtc/video/video_receive_stream.cc
index e8a9da22455c7a79d9b2948071347103987496f7..52da09a82df4444d7401a28703a7161980ed34f0 100644
--- a/webrtc/video/video_receive_stream.cc
+++ b/webrtc/video/video_receive_stream.cc
@@ -491,9 +491,12 @@ void VideoReceiveStream::DecodeThreadFunction(void* ptr) {
bool VideoReceiveStream::Decode() {
TRACE_EVENT0("webrtc", "VideoReceiveStream::Decode");
static const int kMaxWaitForFrameMs = 3000;
+ static const int kMaxWaitForKeyFrameMs = 200;
terelius 2017/08/07 12:00:06 Isn't 200 ms a bit short? It will take at least 1
philipel 2017/08/07 12:09:07 I agree that waiting an RTT between requests is be
noahric 2017/08/07 15:12:29 I don't think you want to wait a full RTT when RTT
philipel 2017/08/07 16:27:49 The old jitter buffer requested a new KF every 500
noahric 2017/08/07 16:48:44 If a decoder requests keyframes on every incoming
+
+ int wait_ms = keyframe_required_ ? kMaxWaitForKeyFrameMs : kMaxWaitForFrameMs;
std::unique_ptr<video_coding::FrameObject> frame;
video_coding::FrameBuffer::ReturnReason res =
- frame_buffer_->NextFrame(kMaxWaitForFrameMs, &frame);
+ frame_buffer_->NextFrame(wait_ms, &frame, keyframe_required_);
if (res == video_coding::FrameBuffer::ReturnReason::kStopped) {
video_receiver_.DecodingStopped();
@@ -502,8 +505,12 @@ bool VideoReceiveStream::Decode() {
if (frame) {
RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kFrameFound);
- if (video_receiver_.Decode(frame.get()) == VCM_OK)
+ if (video_receiver_.Decode(frame.get()) == VCM_OK) {
+ keyframe_required_ = false;
stefan-webrtc 2017/08/07 11:54:38 Is this the behavior we want? https://bugs.chromiu
philipel 2017/08/07 11:59:34 I think this CL will solve that problem as well, i
stefan-webrtc 2017/08/07 12:24:53 Right, I missed that. Do we have test coverage for
philipel 2017/08/07 13:30:11 We don't have any tests for VideoReceiveStream exc
stefan-webrtc 2017/08/09 07:02:35 Ok, perhaps we can write an end-to-end test using
rtp_video_stream_receiver_.FrameDecoded(frame->picture_id);
+ } else {
+ keyframe_required_ = true;
terelius 2017/08/07 12:00:05 Where do we actually send the keyframe request?
philipel 2017/08/07 12:09:07 What happens when we require a keyframe is that we
terelius 2017/08/07 12:48:56 Acknowledged.
+ }
} else {
RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kTimeout);
int64_t now_ms = clock_->TimeInMilliseconds();
@@ -524,7 +531,7 @@ bool VideoReceiveStream::Decode() {
now_ms - *last_keyframe_packet_ms < kMaxWaitForFrameMs;
if (stream_is_active && !receiving_keyframe) {
- LOG(LS_WARNING) << "No decodable frame in " << kMaxWaitForFrameMs
+ LOG(LS_WARNING) << "No decodable frame in " << wait_ms
<< " ms, requesting keyframe.";
RequestKeyFrame();
}
« webrtc/modules/video_coding/video_receiver.cc ('K') | « webrtc/video/video_receive_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698