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

Unified Diff: remoting/protocol/webrtc_frame_scheduler_simple.cc

Issue 2757923004: Fix failed capture handling in WebrtcVideoStream (Closed)
Patch Set: . Created 3 years, 9 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 | « remoting/protocol/webrtc_frame_scheduler_simple.h ('k') | remoting/protocol/webrtc_video_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_frame_scheduler_simple.cc
diff --git a/remoting/protocol/webrtc_frame_scheduler_simple.cc b/remoting/protocol/webrtc_frame_scheduler_simple.cc
index ed037677d65285018d757e6d2e485aaa3499c360..0c44c9ff55df04bb72907ccf060a15cdab582b8b 100644
--- a/remoting/protocol/webrtc_frame_scheduler_simple.cc
+++ b/remoting/protocol/webrtc_frame_scheduler_simple.cc
@@ -178,14 +178,22 @@ bool WebrtcFrameSchedulerSimple::OnFrameCaptured(
base::TimeTicks now = base::TimeTicks::Now();
- if ((!frame || frame->updated_region().is_empty()) && !top_off_is_active_ &&
- !key_frame_request_) {
- frame_pending_ = false;
- ScheduleNextFrame(now);
- return false;
+ if ((!frame || frame->updated_region().is_empty())) {
+ // If we've failed to capture a frame or captured an empty frame we still
+ // need to encode and send the previous frame when top-off is active or a
+ // key-frame was requested. But it makes sense only when we have a frame to
+ // send, i.e. there is nothing to send if first capture request failed.
+ bool resend_last_frame =
+ captured_first_frame_ && (top_off_is_active_ || key_frame_request_);
Jamie 2017/03/21 18:33:36 Given the name of this variable, I would expect to
Sergey Ulanov 2017/03/21 19:40:26 The encoder keeps current frame internally (in YUV
+ if (!resend_last_frame) {
+ frame_pending_ = false;
+ ScheduleNextFrame(now);
+ return false;
+ }
}
if (frame) {
+ captured_first_frame_ = true;
encoder_bitrate_.SetFrameSize(frame->size());
}
« no previous file with comments | « remoting/protocol/webrtc_frame_scheduler_simple.h ('k') | remoting/protocol/webrtc_video_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698