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

Unified Diff: remoting/host/video_scheduler.cc

Issue 394883008: Add basic perf tests for chromoting protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « remoting/host/video_scheduler.h ('k') | remoting/proto/video.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/video_scheduler.cc
diff --git a/remoting/host/video_scheduler.cc b/remoting/host/video_scheduler.cc
index fab4136e918fa2b86d0db8cd0fa141b13b1bf659..24181c393a3085d6aaf405526656a024748a3e95 100644
--- a/remoting/host/video_scheduler.cc
+++ b/remoting/host/video_scheduler.cc
@@ -36,6 +36,13 @@ static const int kMaxPendingFrames = 2;
// RTO used in PseudoTCP, which is 250ms.
static const int kKeepAlivePacketIntervalMs = 200;
+static bool g_enable_timestamps = false;
+
+// static
+void VideoScheduler::EnableTimestampsForTests() {
+ g_enable_timestamps = true;
+}
+
VideoScheduler::VideoScheduler(
scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner,
@@ -86,7 +93,8 @@ void VideoScheduler::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
// that we don't start capturing frame n+2 before frame n is freed.
encode_task_runner_->PostTask(
FROM_HERE, base::Bind(&VideoScheduler::EncodeFrame, this,
- base::Passed(&owned_frame), sequence_number_));
+ base::Passed(&owned_frame), sequence_number_,
+ base::TimeTicks::Now()));
// If a frame was skipped, try to capture it again.
if (did_skip_frame_) {
@@ -337,7 +345,8 @@ void VideoScheduler::SendCursorShape(
void VideoScheduler::EncodeFrame(
scoped_ptr<webrtc::DesktopFrame> frame,
- int64 sequence_number) {
+ int64 sequence_number,
+ base::TimeTicks timestamp) {
DCHECK(encode_task_runner_->BelongsToCurrentThread());
// Drop the frame if there were no changes.
@@ -351,6 +360,10 @@ void VideoScheduler::EncodeFrame(
scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame);
packet->set_client_sequence_number(sequence_number);
+ if (g_enable_timestamps) {
+ packet->set_timestamp(timestamp.ToInternalValue());
+ }
+
// Destroy the frame before sending |packet| because SendVideoPacket() may
// trigger another frame to be captured, and the screen capturer expects the
// old frame to be freed by then.
« no previous file with comments | « remoting/host/video_scheduler.h ('k') | remoting/proto/video.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698