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

Side by Side Diff: remoting/protocol/frame_stats.cc

Issue 2176443002: Add client and host dispatchers for video_stats channel to send video stats from host to client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simple_channel
Patch Set: . Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/protocol/frame_stats.h" 5 #include "remoting/protocol/frame_stats.h"
6 6
7 #include "remoting/proto/video.pb.h" 7 #include "remoting/proto/video.pb.h"
8 #include "remoting/proto/video_stats.pb.h"
8 9
9 namespace remoting { 10 namespace remoting {
10 namespace protocol { 11 namespace protocol {
11 12
12 ClientFrameStats::ClientFrameStats() = default; 13 ClientFrameStats::ClientFrameStats() = default;
13 ClientFrameStats::ClientFrameStats(const ClientFrameStats&) = default; 14 ClientFrameStats::ClientFrameStats(const ClientFrameStats&) = default;
14 ClientFrameStats::~ClientFrameStats() = default; 15 ClientFrameStats::~ClientFrameStats() = default;
15 ClientFrameStats& ClientFrameStats::operator=(const ClientFrameStats&) = 16 ClientFrameStats& ClientFrameStats::operator=(const ClientFrameStats&) =
16 default; 17 default;
17 18
(...skipping 29 matching lines...) Expand all
47 result.encode_pending_delay = 48 result.encode_pending_delay =
48 base::TimeDelta::FromMilliseconds(packet.encode_pending_time_ms()); 49 base::TimeDelta::FromMilliseconds(packet.encode_pending_time_ms());
49 } 50 }
50 if (packet.has_send_pending_time_ms()) { 51 if (packet.has_send_pending_time_ms()) {
51 result.send_pending_delay = 52 result.send_pending_delay =
52 base::TimeDelta::FromMilliseconds(packet.send_pending_time_ms()); 53 base::TimeDelta::FromMilliseconds(packet.send_pending_time_ms());
53 } 54 }
54 return result; 55 return result;
55 } 56 }
56 57
58 // static
59 HostFrameStats HostFrameStats::FromFrameStatsMessage(
60 const FrameStatsMessage& message) {
61 HostFrameStats result;
62 result.frame_size = message.frame_size();
63 if (message.has_latest_event_timestamp()) {
64 result.latest_event_timestamp =
65 base::TimeTicks::FromInternalValue(message.latest_event_timestamp());
66 }
67 if (message.has_capture_time_ms()) {
68 result.capture_delay =
69 base::TimeDelta::FromMilliseconds(message.capture_time_ms());
70 }
71 if (message.has_encode_time_ms()) {
72 result.encode_delay =
73 base::TimeDelta::FromMilliseconds(message.encode_time_ms());
74 }
75 if (message.has_capture_pending_time_ms()) {
76 result.capture_pending_delay =
77 base::TimeDelta::FromMilliseconds(message.capture_pending_time_ms());
78 }
79 if (message.has_capture_overhead_time_ms()) {
80 result.capture_overhead_delay =
81 base::TimeDelta::FromMilliseconds(message.capture_overhead_time_ms());
82 }
83 if (message.has_encode_pending_time_ms()) {
84 result.encode_pending_delay =
85 base::TimeDelta::FromMilliseconds(message.encode_pending_time_ms());
86 }
87
88 if (message.has_send_pending_time_ms()) {
89 result.send_pending_delay =
90 base::TimeDelta::FromMilliseconds(message.send_pending_time_ms());
91 }
92
93 return result;
94 }
95
96 void HostFrameStats::ToFrameStatsMessage(FrameStatsMessage* message_out) const {
97 message_out->set_frame_size(frame_size);
98
99 if (!latest_event_timestamp.is_null()) {
100 message_out->set_latest_event_timestamp(
101 latest_event_timestamp.ToInternalValue());
102 }
103 if (capture_delay != base::TimeDelta::Max()) {
104 message_out->set_capture_time_ms(capture_delay.InMilliseconds());
105 }
106 if (encode_delay != base::TimeDelta::Max()) {
107 message_out->set_encode_time_ms(encode_delay.InMilliseconds());
108 }
109 if (capture_pending_delay != base::TimeDelta::Max()) {
110 message_out->set_capture_pending_time_ms(
111 capture_pending_delay.InMilliseconds());
112 }
113 if (capture_overhead_delay != base::TimeDelta::Max()) {
114 message_out->set_capture_overhead_time_ms(
115 capture_overhead_delay.InMilliseconds());
116 }
117 if (encode_pending_delay != base::TimeDelta::Max()) {
118 message_out->set_encode_pending_time_ms(
119 encode_pending_delay.InMilliseconds());
120 }
121 if (send_pending_delay != base::TimeDelta::Max()) {
122 message_out->set_send_pending_time_ms(send_pending_delay.InMilliseconds());
123 }
124
125 }
126
57 FrameStats::FrameStats() = default; 127 FrameStats::FrameStats() = default;
58 FrameStats::FrameStats(const FrameStats&) = default; 128 FrameStats::FrameStats(const FrameStats&) = default;
59 FrameStats::~FrameStats() = default; 129 FrameStats::~FrameStats() = default;
60 130
61 } // namespace protocol 131 } // namespace protocol
62 } // namespace remoting 132 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698