summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-06 21:19:29 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-06 21:19:29 +0000
commitc0f7082fdc8b239027b196a777180899bf7f5ce3 (patch)
tree1b4ff8c2ca9049ef75b80f5f7c1bb7f0762de1c7 /remoting/client
parent9d85fa39bdf901eea6dc70f804e3d2a1001d07ab (diff)
downloadchromium_src-c0f7082fdc8b239027b196a777180899bf7f5ce3.zip
chromium_src-c0f7082fdc8b239027b196a777180899bf7f5ce3.tar.gz
chromium_src-c0f7082fdc8b239027b196a777180899bf7f5ce3.tar.bz2
Chromoting to report roundtrip latency
Doing so by sending a sequence number, essentially the timestamp in every envet message. Capturer at the host will pick up the latest sequence number and pass it through the pipeline. Client will then receive it and determine the latency. This roundtrip latency number however doesn't include time in decoding and rendering. BUG=None TEST=None Review URL: http://codereview.chromium.org/6792038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/chromoting_client.cc11
-rw-r--r--remoting/client/chromoting_client.h3
-rw-r--r--remoting/client/chromoting_stats.cc3
-rw-r--r--remoting/client/chromoting_stats.h2
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.cc4
-rw-r--r--remoting/client/plugin/chromoting_scriptable_object.h3
6 files changed, 24 insertions, 2 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc
index 2e4e7334..697245c 100644
--- a/remoting/client/chromoting_client.cc
+++ b/remoting/client/chromoting_client.cc
@@ -30,7 +30,8 @@ ChromotingClient::ChromotingClient(const ClientConfig& config,
input_handler_(input_handler),
client_done_(client_done),
state_(CREATED),
- packet_being_processed_(false) {
+ packet_being_processed_(false),
+ last_sequence_number_(0) {
}
ChromotingClient::~ChromotingClient() {
@@ -137,6 +138,14 @@ void ChromotingClient::ProcessVideoPacket(const VideoPacket* packet,
stats_.video_capture_ms()->Record(packet->capture_time_ms());
if (packet->has_encode_time_ms())
stats_.video_encode_ms()->Record(packet->encode_time_ms());
+ if (packet->has_client_sequence_number() &&
+ packet->client_sequence_number() > last_sequence_number_) {
+ last_sequence_number_ = packet->client_sequence_number();
+ base::TimeDelta round_trip_latency =
+ base::Time::Now() -
+ base::Time::FromInternalValue(packet->client_sequence_number());
+ stats_.round_trip_ms()->Record(round_trip_latency.InMilliseconds());
+ }
received_packets_.push_back(QueuedVideoPacket(packet, done));
if (!packet_being_processed_)
diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h
index 31dd631..fb785d7 100644
--- a/remoting/client/chromoting_client.h
+++ b/remoting/client/chromoting_client.h
@@ -136,6 +136,9 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
// Record the statistics of the connection.
ChromotingStats stats_;
+ // Keep track of the last sequence number bounced back from the host.
+ int64 last_sequence_number_;
+
DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
};
diff --git a/remoting/client/chromoting_stats.cc b/remoting/client/chromoting_stats.cc
index 2fba7c6..9acaedc 100644
--- a/remoting/client/chromoting_stats.cc
+++ b/remoting/client/chromoting_stats.cc
@@ -22,7 +22,8 @@ ChromotingStats::ChromotingStats()
video_capture_ms_(kLatencyWindow),
video_encode_ms_(kLatencyWindow),
video_decode_ms_(kLatencyWindow),
- video_paint_ms_(kLatencyWindow) {
+ video_paint_ms_(kLatencyWindow),
+ round_trip_ms_(kLatencyWindow) {
}
ChromotingStats::~ChromotingStats() {
diff --git a/remoting/client/chromoting_stats.h b/remoting/client/chromoting_stats.h
index 174279b..9e91457 100644
--- a/remoting/client/chromoting_stats.h
+++ b/remoting/client/chromoting_stats.h
@@ -23,6 +23,7 @@ class ChromotingStats {
RunningAverage* video_encode_ms() { return &video_encode_ms_; }
RunningAverage* video_decode_ms() { return &video_decode_ms_; }
RunningAverage* video_paint_ms() { return &video_paint_ms_; }
+ RunningAverage* round_trip_ms() { return &round_trip_ms_; }
private:
RateCounter video_bandwidth_;
@@ -30,6 +31,7 @@ class ChromotingStats {
RunningAverage video_encode_ms_;
RunningAverage video_decode_ms_;
RunningAverage video_paint_ms_;
+ RunningAverage round_trip_ms_;
DISALLOW_COPY_AND_ASSIGN(ChromotingStats);
};
diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc
index e2c4126..a12ec53 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -32,6 +32,7 @@ const char kVideoCaptureLatencyAttribute[] = "videoCaptureLatency";
const char kVideoEncodeLatencyAttribute[] = "videoEncodeLatency";
const char kVideoDecodeLatencyAttribute[] = "videoDecodeLatency";
const char kVideoRenderLatencyAttribute[] = "videoRenderLatency";
+const char kRoundTripLatencyAttribute[] = "roundTripLatency";
} // namespace
@@ -81,6 +82,7 @@ void ChromotingScriptableObject::Init() {
AddAttribute(kVideoEncodeLatencyAttribute, Var());
AddAttribute(kVideoDecodeLatencyAttribute, Var());
AddAttribute(kVideoRenderLatencyAttribute, Var());
+ AddAttribute(kRoundTripLatencyAttribute, Var());
AddMethod("connect", &ChromotingScriptableObject::DoConnect);
AddMethod("connectSandboxed",
@@ -153,6 +155,8 @@ Var ChromotingScriptableObject::GetProperty(const Var& name, Var* exception) {
return stats ? stats->video_decode_ms()->Average() : Var();
if (name.AsString() == kVideoRenderLatencyAttribute)
return stats ? stats->video_paint_ms()->Average() : Var();
+ if (name.AsString() == kRoundTripLatencyAttribute)
+ return stats ? stats->round_trip_ms()->Average() : Var();
// TODO(ajwong): This incorrectly return a null object if a function
// property is requested.
diff --git a/remoting/client/plugin/chromoting_scriptable_object.h b/remoting/client/plugin/chromoting_scriptable_object.h
index 62f9c68..317d90f 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.h
+++ b/remoting/client/plugin/chromoting_scriptable_object.h
@@ -25,6 +25,9 @@
// readonly attribute int videoDecodeLatency;
// // Latency for rendering in milliseconds.
// readonly attribute int videoRenderLatency;
+// // Latency between an event is sent and a corresponding video packet is
+// // received.
+// readonly attribute int roundTripLatency;
//
// // Constants for connection status.
// const unsigned short STATUS_UNKNOWN = 0;