diff options
author | hclam@google.com <hclam@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-05 20:13:47 +0000 |
---|---|---|
committer | hclam@google.com <hclam@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-05 20:13:47 +0000 |
commit | 7f65131b89a9636a566b3b3280beab05a05c6699 (patch) | |
tree | 0bd0d00068d23e3e86388bdb1995af757474b968 /remoting/client | |
parent | 27e7d3cd9507411ab96bf43d3e5dd6dada53e105 (diff) | |
download | chromium_src-7f65131b89a9636a566b3b3280beab05a05c6699.zip chromium_src-7f65131b89a9636a566b3b3280beab05a05c6699.tar.gz chromium_src-7f65131b89a9636a566b3b3280beab05a05c6699.tar.bz2 |
Report capture and encode time for chromoting
Add hooks to record these numbers and report them in the client.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/6767009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r-- | remoting/client/chromoting_client.cc | 11 | ||||
-rw-r--r-- | remoting/client/chromoting_client.h | 4 | ||||
-rw-r--r-- | remoting/client/chromoting_stats.cc | 11 | ||||
-rw-r--r-- | remoting/client/chromoting_stats.h | 12 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_scriptable_object.cc | 21 | ||||
-rw-r--r-- | remoting/client/plugin/chromoting_scriptable_object.h | 8 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_view.cc | 2 |
7 files changed, 47 insertions, 22 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index cdfd4ab..2e4e7334 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc @@ -132,6 +132,12 @@ void ChromotingClient::ProcessVideoPacket(const VideoPacket* packet, // Record size of the packet for statistics. stats_.video_bandwidth()->Record(packet->data().size()); + // Record statistics received from host. + if (packet->has_capture_time_ms()) + stats_.video_capture_ms()->Record(packet->capture_time_ms()); + if (packet->has_encode_time_ms()) + stats_.video_encode_ms()->Record(packet->encode_time_ms()); + received_packets_.push_back(QueuedVideoPacket(packet, done)); if (!packet_being_processed_) DispatchPacket(); @@ -214,9 +220,10 @@ void ChromotingClient::OnPacketDone(bool last_packet, TraceContext::tracer()->PrintString("Packet done"); - // Record the latency between the last packet being received and presented. + // Record the latency between the final packet being received and + // presented. if (last_packet) { - stats_.video_decode()->Record( + stats_.video_decode_ms()->Record( (base::Time::Now() - decode_start).InMilliseconds()); } diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h index 9670a94..31dd631 100644 --- a/remoting/client/chromoting_client.h +++ b/remoting/client/chromoting_client.h @@ -106,8 +106,8 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, void DispatchPacket(); // Callback method when a VideoPacket is processed. - // If |last_packet| is true when |decode_start| contains the timestamp when - // the packet starts to be processed. + // If |last_packet| is true then |decode_start| contains the timestamp when + // the packet will start to be processed. void OnPacketDone(bool last_packet, base::Time decode_start); // The following are not owned by this class. diff --git a/remoting/client/chromoting_stats.cc b/remoting/client/chromoting_stats.cc index 4305e61..a9b10e1 100644 --- a/remoting/client/chromoting_stats.cc +++ b/remoting/client/chromoting_stats.cc @@ -6,8 +6,11 @@ namespace { -// The default window of bandwidth in seconds. +// The default window of bandwidth in seconds. Bandwidth is reported as +// number of numbers received in this time frame. static const int kBandwidthWindow = 3; + +// We take the last 10 latency numbers and report the average. static const int kLatencyWindow = 10; } // namespace @@ -16,8 +19,10 @@ namespace remoting { ChromotingStats::ChromotingStats() : video_bandwidth_(base::TimeDelta::FromSeconds(kBandwidthWindow)), - video_decode_(kLatencyWindow), - video_paint_(kLatencyWindow) { + video_capture_ms_(kLatencyWindow), + video_encode_ms_(kLatencyWindow), + video_decode_ms_(kLatencyWindow), + video_paint_ms_(kLatencyWindow) { } } // namespace remoting diff --git a/remoting/client/chromoting_stats.h b/remoting/client/chromoting_stats.h index 32dd22b..e9f89ff 100644 --- a/remoting/client/chromoting_stats.h +++ b/remoting/client/chromoting_stats.h @@ -18,13 +18,17 @@ class ChromotingStats { ChromotingStats(); RateCounter* video_bandwidth() { return &video_bandwidth_; } - RunningAverage* video_decode() { return &video_decode_; } - RunningAverage* video_paint() { return &video_paint_; } + RunningAverage* video_capture_ms() { return &video_capture_ms_; } + RunningAverage* video_encode_ms() { return &video_encode_ms_; } + RunningAverage* video_decode_ms() { return &video_decode_ms_; } + RunningAverage* video_paint_ms() { return &video_paint_ms_; } private: RateCounter video_bandwidth_; - RunningAverage video_decode_; - RunningAverage video_paint_; + RunningAverage video_capture_ms_; + RunningAverage video_encode_ms_; + RunningAverage video_decode_ms_; + RunningAverage video_paint_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 db5fd53..714be1f 100644 --- a/remoting/client/plugin/chromoting_scriptable_object.cc +++ b/remoting/client/plugin/chromoting_scriptable_object.cc @@ -28,6 +28,8 @@ const char kSendIq[] = "sendIq"; const char kQualityAttribute[] = "quality"; const char kStatusAttribute[] = "status"; const char kVideoBandwidthAttribute[] = "videoBandwidth"; +const char kVideoCaptureLatencyAttribute[] = "videoCaptureLatency"; +const char kVideoEncodeLatencyAttribute[] = "videoEncodeLatency"; const char kVideoDecodeLatencyAttribute[] = "videoDecodeLatency"; const char kVideoRenderLatencyAttribute[] = "videoRenderLatency"; @@ -75,6 +77,8 @@ void ChromotingScriptableObject::Init() { // Statistics. AddAttribute(kVideoBandwidthAttribute, Var()); + AddAttribute(kVideoCaptureLatencyAttribute, Var()); + AddAttribute(kVideoEncodeLatencyAttribute, Var()); AddAttribute(kVideoDecodeLatencyAttribute, Var()); AddAttribute(kVideoRenderLatencyAttribute, Var()); @@ -137,15 +141,16 @@ Var ChromotingScriptableObject::GetProperty(const Var& name, Var* exception) { // If this is a statistics attribute then return the value from // ChromotingStats structure. - if (name.AsString() == kVideoBandwidthAttribute) { + if (name.AsString() == kVideoBandwidthAttribute) return instance_->GetStats()->video_bandwidth()->Rate(); - } - else if (name.AsString() == kVideoDecodeLatencyAttribute) { - return instance_->GetStats()->video_decode()->Average(); - } - else if (name.AsString() == kVideoRenderLatencyAttribute) { - return instance_->GetStats()->video_paint()->Average(); - } + if (name.AsString() == kVideoCaptureLatencyAttribute) + return instance_->GetStats()->video_capture_ms()->Average(); + if (name.AsString() == kVideoEncodeLatencyAttribute) + return instance_->GetStats()->video_encode_ms()->Average(); + if (name.AsString() == kVideoDecodeLatencyAttribute) + return instance_->GetStats()->video_decode_ms()->Average(); + if (name.AsString() == kVideoRenderLatencyAttribute) + return instance_->GetStats()->video_paint_ms()->Average(); // 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 d98f37c..bf997b3 100644 --- a/remoting/client/plugin/chromoting_scriptable_object.h +++ b/remoting/client/plugin/chromoting_scriptable_object.h @@ -17,9 +17,13 @@ // // Statistics. // // Video Bandwidth in bytes per second. // readonly attribute float videoBandwidth; -// // Latency for video decoding. +// // Latency for capturing in milliseconds. +// readonly attribute int videoCaptureLatency; +// // Latency for video encoding in milliseconds. +// readonly attribute int videoEncodeLatency; +// // Latency for video decoding in milliseconds. // readonly attribute int videoDecodeLatency; -// // Latency for rendering. +// // Latency for rendering in milliseconds. // readonly attribute int videoRenderLatency; // // // Constants for connection status. diff --git a/remoting/client/plugin/pepper_view.cc b/remoting/client/plugin/pepper_view.cc index 257ff52b..6dc9a51 100644 --- a/remoting/client/plugin/pepper_view.cc +++ b/remoting/client/plugin/pepper_view.cc @@ -253,7 +253,7 @@ void PepperView::OnPartialFrameOutput(media::VideoFrame* frame, void PepperView::OnPaintDone(base::Time paint_start) { DCHECK(CurrentlyOnPluginThread()); TraceContext::tracer()->PrintString("Paint flushed"); - instance_->GetStats()->video_paint()->Record( + instance_->GetStats()->video_paint_ms()->Record( (base::Time::Now() - paint_start).InMilliseconds()); return; } |