OLD | NEW |
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 #include "remoting/proto/video_stats.pb.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 base::TimeDelta::FromMilliseconds(message.capture_pending_time_ms()); | 77 base::TimeDelta::FromMilliseconds(message.capture_pending_time_ms()); |
78 } | 78 } |
79 if (message.has_capture_overhead_time_ms()) { | 79 if (message.has_capture_overhead_time_ms()) { |
80 result.capture_overhead_delay = | 80 result.capture_overhead_delay = |
81 base::TimeDelta::FromMilliseconds(message.capture_overhead_time_ms()); | 81 base::TimeDelta::FromMilliseconds(message.capture_overhead_time_ms()); |
82 } | 82 } |
83 if (message.has_encode_pending_time_ms()) { | 83 if (message.has_encode_pending_time_ms()) { |
84 result.encode_pending_delay = | 84 result.encode_pending_delay = |
85 base::TimeDelta::FromMilliseconds(message.encode_pending_time_ms()); | 85 base::TimeDelta::FromMilliseconds(message.encode_pending_time_ms()); |
86 } | 86 } |
87 | |
88 if (message.has_send_pending_time_ms()) { | 87 if (message.has_send_pending_time_ms()) { |
89 result.send_pending_delay = | 88 result.send_pending_delay = |
90 base::TimeDelta::FromMilliseconds(message.send_pending_time_ms()); | 89 base::TimeDelta::FromMilliseconds(message.send_pending_time_ms()); |
91 } | 90 } |
| 91 if (message.has_rtt_estimate_ms()) { |
| 92 result.rtt_estimate = |
| 93 base::TimeDelta::FromMilliseconds(message.rtt_estimate_ms()); |
| 94 } |
| 95 if (message.has_bandwidth_estimate_kbps()) { |
| 96 result.bandwidth_estimate_kbps = message.bandwidth_estimate_kbps(); |
| 97 } |
92 | 98 |
93 return result; | 99 return result; |
94 } | 100 } |
95 | 101 |
96 void HostFrameStats::ToFrameStatsMessage(FrameStatsMessage* message_out) const { | 102 void HostFrameStats::ToFrameStatsMessage(FrameStatsMessage* message_out) const { |
97 message_out->set_frame_size(frame_size); | 103 message_out->set_frame_size(frame_size); |
98 | 104 |
99 if (!latest_event_timestamp.is_null()) { | 105 if (!latest_event_timestamp.is_null()) { |
100 message_out->set_latest_event_timestamp( | 106 message_out->set_latest_event_timestamp( |
101 latest_event_timestamp.ToInternalValue()); | 107 latest_event_timestamp.ToInternalValue()); |
(...skipping 12 matching lines...) Expand all Loading... |
114 message_out->set_capture_overhead_time_ms( | 120 message_out->set_capture_overhead_time_ms( |
115 capture_overhead_delay.InMilliseconds()); | 121 capture_overhead_delay.InMilliseconds()); |
116 } | 122 } |
117 if (encode_pending_delay != base::TimeDelta::Max()) { | 123 if (encode_pending_delay != base::TimeDelta::Max()) { |
118 message_out->set_encode_pending_time_ms( | 124 message_out->set_encode_pending_time_ms( |
119 encode_pending_delay.InMilliseconds()); | 125 encode_pending_delay.InMilliseconds()); |
120 } | 126 } |
121 if (send_pending_delay != base::TimeDelta::Max()) { | 127 if (send_pending_delay != base::TimeDelta::Max()) { |
122 message_out->set_send_pending_time_ms(send_pending_delay.InMilliseconds()); | 128 message_out->set_send_pending_time_ms(send_pending_delay.InMilliseconds()); |
123 } | 129 } |
124 | 130 if (rtt_estimate != base::TimeDelta::Max()) { |
| 131 message_out->set_rtt_estimate_ms(rtt_estimate.InMilliseconds()); |
| 132 } |
| 133 if (bandwidth_estimate_kbps >= 0) { |
| 134 message_out->set_bandwidth_estimate_kbps(bandwidth_estimate_kbps); |
| 135 } |
125 } | 136 } |
126 | 137 |
127 FrameStats::FrameStats() = default; | 138 FrameStats::FrameStats() = default; |
128 FrameStats::FrameStats(const FrameStats&) = default; | 139 FrameStats::FrameStats(const FrameStats&) = default; |
129 FrameStats::~FrameStats() = default; | 140 FrameStats::~FrameStats() = default; |
130 | 141 |
131 } // namespace protocol | 142 } // namespace protocol |
132 } // namespace remoting | 143 } // namespace remoting |
OLD | NEW |