summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/chromoting_client.cc7
-rw-r--r--remoting/client/chromoting_stats.cc8
-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.h2
-rw-r--r--remoting/webapp/me2mom/client_session.js1
-rw-r--r--remoting/webapp/me2mom/remoting.js3
7 files changed, 20 insertions, 7 deletions
diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc
index 7251bd6..87a7fe0 100644
--- a/remoting/client/chromoting_client.cc
+++ b/remoting/client/chromoting_client.cc
@@ -100,10 +100,11 @@ void ChromotingClient::ProcessVideoPacket(const VideoPacket* packet,
return;
}
- // Record size of the packet for statistics.
- stats_.video_bandwidth()->Record(packet->data().size());
+ // Add one frame to the counter.
+ stats_.video_frame_rate()->Record(1);
- // Record statistics received from host.
+ // Record other statistics received from host.
+ stats_.video_bandwidth()->Record(packet->data().size());
if (packet->has_capture_time_ms())
stats_.video_capture_ms()->Record(packet->capture_time_ms());
if (packet->has_encode_time_ms())
diff --git a/remoting/client/chromoting_stats.cc b/remoting/client/chromoting_stats.cc
index 9acaedc..604319d 100644
--- a/remoting/client/chromoting_stats.cc
+++ b/remoting/client/chromoting_stats.cc
@@ -6,9 +6,8 @@
namespace {
-// The default window of bandwidth in seconds. Bandwidth is reported as
-// number of numbers received in this time frame.
-static const int kBandwidthWindow = 3;
+// The default window of bandwidth and frame rate in seconds.
+static const int kTimeWindow = 3;
// We take the last 10 latency numbers and report the average.
static const int kLatencyWindow = 10;
@@ -18,7 +17,8 @@ static const int kLatencyWindow = 10;
namespace remoting {
ChromotingStats::ChromotingStats()
- : video_bandwidth_(base::TimeDelta::FromSeconds(kBandwidthWindow)),
+ : video_bandwidth_(base::TimeDelta::FromSeconds(kTimeWindow)),
+ video_frame_rate_(base::TimeDelta::FromSeconds(kTimeWindow)),
video_capture_ms_(kLatencyWindow),
video_encode_ms_(kLatencyWindow),
video_decode_ms_(kLatencyWindow),
diff --git a/remoting/client/chromoting_stats.h b/remoting/client/chromoting_stats.h
index 9e91457..da7601b 100644
--- a/remoting/client/chromoting_stats.h
+++ b/remoting/client/chromoting_stats.h
@@ -19,6 +19,7 @@ class ChromotingStats {
virtual ~ChromotingStats();
RateCounter* video_bandwidth() { return &video_bandwidth_; }
+ RateCounter* video_frame_rate() { return &video_frame_rate_; }
RunningAverage* video_capture_ms() { return &video_capture_ms_; }
RunningAverage* video_encode_ms() { return &video_encode_ms_; }
RunningAverage* video_decode_ms() { return &video_decode_ms_; }
@@ -27,6 +28,7 @@ class ChromotingStats {
private:
RateCounter video_bandwidth_;
+ RateCounter video_frame_rate_;
RunningAverage video_capture_ms_;
RunningAverage video_encode_ms_;
RunningAverage video_decode_ms_;
diff --git a/remoting/client/plugin/chromoting_scriptable_object.cc b/remoting/client/plugin/chromoting_scriptable_object.cc
index c19f8ff..0ad8c4a 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.cc
+++ b/remoting/client/plugin/chromoting_scriptable_object.cc
@@ -33,6 +33,7 @@ const char kSendIq[] = "sendIq";
const char kStatusAttribute[] = "status";
const char kErrorAttribute[] = "error";
const char kVideoBandwidthAttribute[] = "videoBandwidth";
+const char kVideoFrameRateAttribute[] = "videoFrameRate";
const char kVideoCaptureLatencyAttribute[] = "videoCaptureLatency";
const char kVideoEncodeLatencyAttribute[] = "videoEncodeLatency";
const char kVideoDecodeLatencyAttribute[] = "videoDecodeLatency";
@@ -95,6 +96,7 @@ void ChromotingScriptableObject::Init() {
// Statistics.
AddAttribute(kVideoBandwidthAttribute, Var());
+ AddAttribute(kVideoFrameRateAttribute, Var());
AddAttribute(kVideoCaptureLatencyAttribute, Var());
AddAttribute(kVideoEncodeLatencyAttribute, Var());
AddAttribute(kVideoDecodeLatencyAttribute, Var());
@@ -163,6 +165,8 @@ Var ChromotingScriptableObject::GetProperty(const Var& name, Var* exception) {
ChromotingStats* stats = instance_->GetStats();
if (name.AsString() == kVideoBandwidthAttribute)
return stats ? stats->video_bandwidth()->Rate() : Var();
+ if (name.AsString() == kVideoFrameRateAttribute)
+ return stats ? stats->video_frame_rate()->Rate() : Var();
if (name.AsString() == kVideoCaptureLatencyAttribute)
return stats ? stats->video_capture_ms()->Average() : Var();
if (name.AsString() == kVideoEncodeLatencyAttribute)
diff --git a/remoting/client/plugin/chromoting_scriptable_object.h b/remoting/client/plugin/chromoting_scriptable_object.h
index b138f9f..311ee81 100644
--- a/remoting/client/plugin/chromoting_scriptable_object.h
+++ b/remoting/client/plugin/chromoting_scriptable_object.h
@@ -68,6 +68,8 @@
// // Statistics.
// // Video Bandwidth in bytes per second.
// readonly attribute float videoBandwidth;
+// // Video frames received per second.
+// readonly attribute float videoFrameRate;
// // Latency for capturing in milliseconds.
// readonly attribute int videoCaptureLatency;
// // Latency for video encoding in milliseconds.
diff --git a/remoting/webapp/me2mom/client_session.js b/remoting/webapp/me2mom/client_session.js
index cbb6bdc..5afa4d2 100644
--- a/remoting/webapp/me2mom/client_session.js
+++ b/remoting/webapp/me2mom/client_session.js
@@ -407,6 +407,7 @@ remoting.ClientSession.prototype.updateDimensions = function() {
remoting.ClientSession.prototype.stats = function() {
return {
'video_bandwidth': this.plugin.videoBandwidth,
+ 'video_frame_rate': this.plugin.videoFramerate,
'capture_latency': this.plugin.videoCaptureLatency,
'encode_latency': this.plugin.videoEncodeLatency,
'decode_latency': this.plugin.videoDecodeLatency,
diff --git a/remoting/webapp/me2mom/remoting.js b/remoting/webapp/me2mom/remoting.js
index 0e918f2..3690eb1 100644
--- a/remoting/webapp/me2mom/remoting.js
+++ b/remoting/webapp/me2mom/remoting.js
@@ -509,6 +509,9 @@ function updateStatistics() {
var statistics = document.getElementById('statistics');
statistics.innerText =
'Bandwidth: ' + videoBandwidth.toFixed(2) + units +
+ ', Frame Rate: ' +
+ (stats['video_frame_rate'] ?
+ stats['video_frame_rate'].toFixed(2) + ' fps' : 'n/a') +
', Capture: ' + stats['capture_latency'].toFixed(2) + 'ms' +
', Encode: ' + stats['encode_latency'].toFixed(2) + 'ms' +
', Decode: ' + stats['decode_latency'].toFixed(2) + 'ms' +