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

Unified Diff: remoting/host/screen_recorder.cc

Issue 6792038: Chromoting to report roundtrip latency (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: done Created 9 years, 8 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/screen_recorder.h ('k') | remoting/proto/internal.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/screen_recorder.cc
diff --git a/remoting/host/screen_recorder.cc b/remoting/host/screen_recorder.cc
index f4730c1fb6e6c933302cb3d0849c9788c0aecbd3..e1ba8b138bbf527329d1ea28a66a814c0b3a3213 100644
--- a/remoting/host/screen_recorder.cc
+++ b/remoting/host/screen_recorder.cc
@@ -49,7 +49,8 @@ ScreenRecorder::ScreenRecorder(
network_stopped_(false),
recordings_(0),
frame_skipped_(false),
- max_rate_(kDefaultCaptureRate) {
+ max_rate_(kDefaultCaptureRate),
+ sequence_number_(0) {
DCHECK(capture_loop_);
DCHECK(encode_loop_);
DCHECK(network_loop_);
@@ -102,6 +103,19 @@ void ScreenRecorder::RemoveAllConnections() {
NewTracedMethod(this, &ScreenRecorder::DoRemoveAllClients));
}
+void ScreenRecorder::UpdateSequenceNumber(int64 sequence_number) {
+ // Sequence number is used and written only on the capture thread.
+ if (MessageLoop::current() != capture_loop_) {
+ capture_loop_->PostTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &ScreenRecorder::UpdateSequenceNumber,
+ sequence_number));
+ return;
+ }
+
+ sequence_number_ = sequence_number;
+}
+
// Private accessors -----------------------------------------------------------
Capturer* ScreenRecorder::capturer() {
@@ -228,6 +242,14 @@ void ScreenRecorder::CaptureDoneCallback(
int capture_time = static_cast<int>(
(base::Time::Now() - capture_start_time_).InMilliseconds());
capture_data->set_capture_time_ms(capture_time);
+
+ // The best way to get this value is by binding the sequence number to
+ // the callback when calling CaptureInvalidRects(). However the callback
+ // system doesn't allow this. Reading from the member variable is
+ // accurate as long as capture is synchronous as the following statement
+ // will obtain the most recent sequence number received.
+ capture_data->set_client_sequence_number(sequence_number_);
+
encode_loop_->PostTask(
FROM_HERE,
NewTracedMethod(this, &ScreenRecorder::DoEncode, capture_data));
« no previous file with comments | « remoting/host/screen_recorder.h ('k') | remoting/proto/internal.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698