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

Side by Side Diff: remoting/client/software_video_renderer.cc

Issue 1181743005: Report video and network stats averaged over 1s, and create corresponding UMA metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update stats for software-renderer as well. Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/software_video_renderer.h" 5 #include "remoting/client/software_video_renderer.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/metrics/histogram_macros.h"
14 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
15 #include "remoting/base/util.h" 16 #include "remoting/base/util.h"
16 #include "remoting/client/frame_consumer.h" 17 #include "remoting/client/frame_consumer.h"
17 #include "remoting/codec/video_decoder.h" 18 #include "remoting/codec/video_decoder.h"
18 #include "remoting/codec/video_decoder_verbatim.h" 19 #include "remoting/codec/video_decoder_verbatim.h"
19 #include "remoting/codec/video_decoder_vpx.h" 20 #include "remoting/codec/video_decoder_vpx.h"
20 #include "remoting/protocol/session_config.h" 21 #include "remoting/protocol/session_config.h"
21 #include "third_party/libyuv/include/libyuv/convert_argb.h" 22 #include "third_party/libyuv/include/libyuv/convert_argb.h"
22 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 23 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
23 24
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (!packet->has_data() || packet->data().size() == 0) { 356 if (!packet->has_data() || packet->data().size() == 0) {
356 done.Run(); 357 done.Run();
357 return; 358 return;
358 } 359 }
359 360
360 // Add one frame to the counter. 361 // Add one frame to the counter.
361 stats_.video_frame_rate()->Record(1); 362 stats_.video_frame_rate()->Record(1);
362 363
363 // Record other statistics received from host. 364 // Record other statistics received from host.
364 stats_.video_bandwidth()->Record(packet->data().size()); 365 stats_.video_bandwidth()->Record(packet->data().size());
365 if (packet->has_capture_time_ms()) 366 if (packet->has_capture_time_ms()) {
366 stats_.video_capture_ms()->Record(packet->capture_time_ms()); 367 stats_.video_capture_ms()->Record(packet->capture_time_ms());
367 if (packet->has_encode_time_ms()) 368 const base::TimeDelta capture_time =
369 base::TimeDelta::FromInternalValue(packet->capture_time_ms());
370 UMA_HISTOGRAM_TIMES("Chromoting.Video.CaptureLatency", capture_time);
371 }
372 if (packet->has_encode_time_ms()) {
368 stats_.video_encode_ms()->Record(packet->encode_time_ms()); 373 stats_.video_encode_ms()->Record(packet->encode_time_ms());
374 const base::TimeDelta encode_time =
375 base::TimeDelta::FromInternalValue(packet->encode_time_ms());
376 UMA_HISTOGRAM_TIMES("Chromoting.Video.EncodeLatency", encode_time);
377 }
369 if (packet->has_latest_event_timestamp() && 378 if (packet->has_latest_event_timestamp() &&
370 packet->latest_event_timestamp() > latest_event_timestamp_) { 379 packet->latest_event_timestamp() > latest_event_timestamp_) {
371 latest_event_timestamp_ = packet->latest_event_timestamp(); 380 latest_event_timestamp_ = packet->latest_event_timestamp();
372 base::TimeDelta round_trip_latency = 381 base::TimeDelta round_trip_latency =
373 base::Time::Now() - 382 base::Time::Now() -
374 base::Time::FromInternalValue(packet->latest_event_timestamp()); 383 base::Time::FromInternalValue(packet->latest_event_timestamp());
375 stats_.round_trip_ms()->Record(round_trip_latency.InMilliseconds()); 384 stats_.round_trip_ms()->Record(round_trip_latency.InMilliseconds());
385 UMA_HISTOGRAM_TIMES("Chromoting.Video.RoundTripLatency",
386 round_trip_latency);
376 } 387 }
377 388
378 // Measure the latency between the last packet being received and presented. 389 // Measure the latency between the last packet being received and presented.
379 base::Time decode_start = base::Time::Now(); 390 base::Time decode_start = base::Time::Now();
380 391
381 base::Closure decode_done = base::Bind(&SoftwareVideoRenderer::OnPacketDone, 392 base::Closure decode_done = base::Bind(&SoftwareVideoRenderer::OnPacketDone,
382 weak_factory_.GetWeakPtr(), 393 weak_factory_.GetWeakPtr(),
383 decode_start, done); 394 decode_start, done);
384 395
385 decode_task_runner_->PostTask(FROM_HERE, base::Bind( 396 decode_task_runner_->PostTask(FROM_HERE, base::Bind(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 DCHECK(CalledOnValidThread()); 432 DCHECK(CalledOnValidThread());
422 433
423 // Record the latency between the packet being received and presented. 434 // Record the latency between the packet being received and presented.
424 stats_.video_decode_ms()->Record( 435 stats_.video_decode_ms()->Record(
425 (base::Time::Now() - decode_start).InMilliseconds()); 436 (base::Time::Now() - decode_start).InMilliseconds());
426 437
427 done.Run(); 438 done.Run();
428 } 439 }
429 440
430 } // namespace remoting 441 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698