| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/protocol/frame_stats.h" |
| 6 |
| 7 #include "remoting/proto/video.pb.h" |
| 8 |
| 9 namespace remoting { |
| 10 namespace protocol { |
| 11 |
| 12 FrameStats::FrameStats() = default; |
| 13 FrameStats::FrameStats(const FrameStats&) = default; |
| 14 FrameStats::~FrameStats() = default; |
| 15 |
| 16 // static |
| 17 FrameStats FrameStats::GetForVideoPacket(const VideoPacket& packet) { |
| 18 FrameStats result; |
| 19 result.frame_size = packet.data().size(); |
| 20 result.time_received = base::TimeTicks::Now(); |
| 21 if (packet.has_latest_event_timestamp()) { |
| 22 result.latest_event_timestamp = |
| 23 base::TimeTicks::FromInternalValue(packet.latest_event_timestamp()); |
| 24 } |
| 25 if (packet.has_capture_time_ms()) { |
| 26 result.capture_delay = |
| 27 base::TimeDelta::FromMilliseconds(packet.capture_time_ms()); |
| 28 } |
| 29 if (packet.has_encode_time_ms()) { |
| 30 result.encode_delay = |
| 31 base::TimeDelta::FromMilliseconds(packet.encode_time_ms()); |
| 32 } |
| 33 if (packet.has_capture_pending_time_ms()) { |
| 34 result.capture_pending_delay = |
| 35 base::TimeDelta::FromMilliseconds(packet.capture_pending_time_ms()); |
| 36 } |
| 37 if (packet.has_capture_overhead_time_ms()) { |
| 38 result.capture_overhead_delay = |
| 39 base::TimeDelta::FromMilliseconds(packet.capture_overhead_time_ms()); |
| 40 } |
| 41 if (packet.has_encode_pending_time_ms()) { |
| 42 result.encode_pending_delay = |
| 43 base::TimeDelta::FromMilliseconds(packet.encode_pending_time_ms()); |
| 44 } |
| 45 if (packet.has_send_pending_time_ms()) { |
| 46 result.send_pending_delay = |
| 47 base::TimeDelta::FromMilliseconds(packet.send_pending_time_ms()); |
| 48 } |
| 49 return result; |
| 50 } |
| 51 |
| 52 } // namespace protocol |
| 53 } // namespace remoting |
| OLD | NEW |