summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 22:23:16 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 22:24:43 +0000
commitb2bdc1038cb427cccc546716aac8731b41b0765d (patch)
treee8d91a6db08cf0daf37f0168251a9ebacf5c524d
parenta3e5b6fb90b84681fdb08a29f99696316d0fe546 (diff)
downloadchromium_src-b2bdc1038cb427cccc546716aac8731b41b0765d.zip
chromium_src-b2bdc1038cb427cccc546716aac8731b41b0765d.tar.gz
chromium_src-b2bdc1038cb427cccc546716aac8731b41b0765d.tar.bz2
Send empty video frames when screen is not changing.
Before r272790 the host was sending empty packets 30 times a second when nothing is changing on the screen. After that change and r281677 the frequency was decreased to 5 frame per second. It looks like those changes degraded performance for some users. This change partially restores previous behavior. Empty packets are send for each captured frame even when nothing is changing on the screen. Keep-alive packets are sent every 200ms when there are no other video packets, e.g. when the video stream is paused. Review URL: https://codereview.chromium.org/477103004 Cr-Commit-Position: refs/heads/master@{#290028} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290028 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--remoting/host/video_scheduler.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/remoting/host/video_scheduler.cc b/remoting/host/video_scheduler.cc
index 7dc7f8a..b9f1276c 100644
--- a/remoting/host/video_scheduler.cc
+++ b/remoting/host/video_scheduler.cc
@@ -31,10 +31,10 @@ namespace remoting {
// TODO(hclam): Move this value to CaptureScheduler.
static const int kMaxPendingFrames = 2;
-// Interval between empty keep-alive frames. These frames are sent only
-// when there are no real video frames being sent. To prevent PseudoTCP from
-// resetting congestion window this value must be smaller than the minimum
-// RTO used in PseudoTCP, which is 250ms.
+// Interval between empty keep-alive frames. These frames are sent only when the
+// stream is paused or inactive for some other reason (e.g. when blocked on
+// capturer). To prevent PseudoTCP from resetting congestion window this value
+// must be smaller than the minimum RTO used in PseudoTCP, which is 250ms.
static const int kKeepAlivePacketIntervalMs = 200;
static bool g_enable_timestamps = false;
@@ -374,11 +374,15 @@ void VideoScheduler::EncodeFrame(
base::TimeTicks timestamp) {
DCHECK(encode_task_runner_->BelongsToCurrentThread());
- // Drop the frame if there were no changes.
+ // If there is nothing to encode then send an empty packet.
if (!frame || frame->updated_region().is_empty()) {
capture_task_runner_->DeleteSoon(FROM_HERE, frame.release());
- capture_task_runner_->PostTask(
- FROM_HERE, base::Bind(&VideoScheduler::FrameCaptureCompleted, this));
+ scoped_ptr<VideoPacket> packet(new VideoPacket());
+ packet->set_client_sequence_number(sequence_number);
+ network_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &VideoScheduler::SendVideoPacket, this, base::Passed(&packet)));
return;
}