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

Unified Diff: remoting/protocol/frame_stats.cc

Issue 2096643003: Rework PerformanceTracker to make it usable with WebRTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address feedback Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/frame_stats.h ('k') | remoting/protocol/performance_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/frame_stats.cc
diff --git a/remoting/protocol/frame_stats.cc b/remoting/protocol/frame_stats.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6054b2717740a2061a5791ec3e4fef94deb46630
--- /dev/null
+++ b/remoting/protocol/frame_stats.cc
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/protocol/frame_stats.h"
+
+#include "remoting/proto/video.pb.h"
+
+namespace remoting {
+namespace protocol {
+
+FrameStats::FrameStats() = default;
+FrameStats::FrameStats(const FrameStats&) = default;
+FrameStats::~FrameStats() = default;
+
+// static
+FrameStats FrameStats::GetForVideoPacket(const VideoPacket& packet) {
+ FrameStats result;
+ result.frame_size = packet.data().size();
+ result.time_received = base::TimeTicks::Now();
+ if (packet.has_latest_event_timestamp()) {
+ result.latest_event_timestamp =
+ base::TimeTicks::FromInternalValue(packet.latest_event_timestamp());
+ }
+ if (packet.has_capture_time_ms()) {
+ result.capture_delay =
+ base::TimeDelta::FromMilliseconds(packet.capture_time_ms());
+ }
+ if (packet.has_encode_time_ms()) {
+ result.encode_delay =
+ base::TimeDelta::FromMilliseconds(packet.encode_time_ms());
+ }
+ if (packet.has_capture_pending_time_ms()) {
+ result.capture_pending_delay =
+ base::TimeDelta::FromMilliseconds(packet.capture_pending_time_ms());
+ }
+ if (packet.has_capture_overhead_time_ms()) {
+ result.capture_overhead_delay =
+ base::TimeDelta::FromMilliseconds(packet.capture_overhead_time_ms());
+ }
+ if (packet.has_encode_pending_time_ms()) {
+ result.encode_pending_delay =
+ base::TimeDelta::FromMilliseconds(packet.encode_pending_time_ms());
+ }
+ if (packet.has_send_pending_time_ms()) {
+ result.send_pending_delay =
+ base::TimeDelta::FromMilliseconds(packet.send_pending_time_ms());
+ }
+ return result;
+}
+
+} // namespace protocol
+} // namespace remoting
« no previous file with comments | « remoting/protocol/frame_stats.h ('k') | remoting/protocol/performance_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698