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

Side by Side Diff: remoting/client/chromoting_client.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/chromoting_stats.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/client/chromoting_client.h" 5 #include "remoting/client/chromoting_client.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "remoting/base/tracer.h" 8 #include "remoting/base/tracer.h"
9 #include "remoting/client/chromoting_view.h" 9 #include "remoting/client/chromoting_view.h"
10 #include "remoting/client/client_context.h" 10 #include "remoting/client/client_context.h"
(...skipping 12 matching lines...) Expand all
23 InputHandler* input_handler, 23 InputHandler* input_handler,
24 CancelableTask* client_done) 24 CancelableTask* client_done)
25 : config_(config), 25 : config_(config),
26 context_(context), 26 context_(context),
27 connection_(connection), 27 connection_(connection),
28 view_(view), 28 view_(view),
29 rectangle_decoder_(rectangle_decoder), 29 rectangle_decoder_(rectangle_decoder),
30 input_handler_(input_handler), 30 input_handler_(input_handler),
31 client_done_(client_done), 31 client_done_(client_done),
32 state_(CREATED), 32 state_(CREATED),
33 packet_being_processed_(false) { 33 packet_being_processed_(false),
34 last_sequence_number_(0) {
34 } 35 }
35 36
36 ChromotingClient::~ChromotingClient() { 37 ChromotingClient::~ChromotingClient() {
37 } 38 }
38 39
39 void ChromotingClient::Start() { 40 void ChromotingClient::Start() {
40 if (message_loop() != MessageLoop::current()) { 41 if (message_loop() != MessageLoop::current()) {
41 message_loop()->PostTask( 42 message_loop()->PostTask(
42 FROM_HERE, 43 FROM_HERE,
43 NewRunnableMethod(this, &ChromotingClient::Start)); 44 NewRunnableMethod(this, &ChromotingClient::Start));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 131 }
131 132
132 // Record size of the packet for statistics. 133 // Record size of the packet for statistics.
133 stats_.video_bandwidth()->Record(packet->data().size()); 134 stats_.video_bandwidth()->Record(packet->data().size());
134 135
135 // Record statistics received from host. 136 // Record statistics received from host.
136 if (packet->has_capture_time_ms()) 137 if (packet->has_capture_time_ms())
137 stats_.video_capture_ms()->Record(packet->capture_time_ms()); 138 stats_.video_capture_ms()->Record(packet->capture_time_ms());
138 if (packet->has_encode_time_ms()) 139 if (packet->has_encode_time_ms())
139 stats_.video_encode_ms()->Record(packet->encode_time_ms()); 140 stats_.video_encode_ms()->Record(packet->encode_time_ms());
141 if (packet->has_client_sequence_number() &&
142 packet->client_sequence_number() > last_sequence_number_) {
143 last_sequence_number_ = packet->client_sequence_number();
144 base::TimeDelta round_trip_latency =
145 base::Time::Now() -
146 base::Time::FromInternalValue(packet->client_sequence_number());
147 stats_.round_trip_ms()->Record(round_trip_latency.InMilliseconds());
148 }
140 149
141 received_packets_.push_back(QueuedVideoPacket(packet, done)); 150 received_packets_.push_back(QueuedVideoPacket(packet, done));
142 if (!packet_being_processed_) 151 if (!packet_being_processed_)
143 DispatchPacket(); 152 DispatchPacket();
144 } 153 }
145 154
146 int ChromotingClient::GetPendingPackets() { 155 int ChromotingClient::GetPendingPackets() {
147 return received_packets_.size(); 156 return received_packets_.size();
148 } 157 }
149 158
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (msg->success()) { 299 if (msg->success()) {
291 connection_->OnClientAuthenticated(); 300 connection_->OnClientAuthenticated();
292 } 301 }
293 302
294 view_->UpdateLoginStatus(msg->success(), msg->error_info()); 303 view_->UpdateLoginStatus(msg->success(), msg->error_info());
295 done->Run(); 304 done->Run();
296 delete done; 305 delete done;
297 } 306 }
298 307
299 } // namespace remoting 308 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/chromoting_client.h ('k') | remoting/client/chromoting_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698