OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/api/video/video_timing.h" | 11 #include "webrtc/api/video/video_timing.h" |
12 | 12 |
13 #include <sstream> | 13 #include <sstream> |
14 | 14 |
15 namespace webrtc { | 15 namespace webrtc { |
16 | 16 |
17 TimingFrameInfo::TimingFrameInfo() | 17 TimingFrameInfo::TimingFrameInfo() |
18 : rtp_timestamp(0), | 18 : rtp_timestamp(0), |
19 capture_time_ms(-1), | 19 capture_time_ms(-1), |
20 encode_start_ms(-1), | 20 encode_start_ms(-1), |
21 encode_finish_ms(-1), | 21 encode_finish_ms(-1), |
22 packetization_finish_ms(-1), | 22 packetization_finish_ms(-1), |
23 pacer_exit_ms(-1), | 23 pacer_exit_ms(-1), |
24 network_timestamp_ms(-1), | 24 network_timestamp_ms(-1), |
25 network2_timestamp_ms(-1), | 25 network2_timestamp_ms(-1), |
26 receive_start_ms(-1), | 26 receive_start_ms(-1), |
27 receive_finish_ms(-1), | 27 receive_finish_ms(-1), |
28 decode_start_ms(-1), | 28 decode_start_ms(-1), |
29 decode_finish_ms(-1), | 29 decode_finish_ms(-1), |
30 render_time_ms(-1) {} | 30 render_time_ms(-1), |
31 flags(TimingFrameFlags::kDefault) {} | |
31 | 32 |
32 int64_t TimingFrameInfo::EndToEndDelay() const { | 33 int64_t TimingFrameInfo::EndToEndDelay() const { |
33 return capture_time_ms >= 0 ? decode_finish_ms - capture_time_ms : -1; | 34 return capture_time_ms >= 0 ? decode_finish_ms - capture_time_ms : -1; |
34 } | 35 } |
35 | 36 |
36 bool TimingFrameInfo::IsLongerThan(const TimingFrameInfo& other) const { | 37 bool TimingFrameInfo::IsLongerThan(const TimingFrameInfo& other) const { |
37 int64_t other_delay = other.EndToEndDelay(); | 38 int64_t other_delay = other.EndToEndDelay(); |
38 return other_delay == -1 || EndToEndDelay() > other_delay; | 39 return other_delay == -1 || EndToEndDelay() > other_delay; |
39 } | 40 } |
40 | 41 |
42 bool TimingFrameInfo::IsOutlier() const { | |
43 return flags & TimingFrameFlags::kTriggeredBySize; | |
danilchap
2017/08/11 13:51:16
are Invalid frames outliers?
sprang_webrtc
2017/08/11 15:06:33
No, this is a bug.
| |
44 } | |
45 | |
46 bool TimingFrameInfo::IsInvalid() const { | |
47 return flags == TimingFrameFlags::kTriggeredBySize; | |
danilchap
2017/08/11 13:51:16
== ::kInvalid ?
sprang_webrtc
2017/08/11 15:06:33
Yes. What a brain fart...
| |
48 } | |
49 | |
41 std::string TimingFrameInfo::ToString() const { | 50 std::string TimingFrameInfo::ToString() const { |
42 std::stringstream out; | 51 std::stringstream out; |
43 out << rtp_timestamp << ',' << capture_time_ms << ',' << encode_start_ms | 52 if (IsInvalid()) { |
44 << ',' << encode_finish_ms << ',' << packetization_finish_ms << ',' | 53 out << "[Invalid]"; |
45 << pacer_exit_ms << ',' << network_timestamp_ms << ',' | 54 } else { |
46 << network2_timestamp_ms << ',' << receive_start_ms << ',' | 55 out << rtp_timestamp << ',' << capture_time_ms << ',' << encode_start_ms |
47 << receive_finish_ms << ',' << decode_start_ms << ',' << decode_finish_ms | 56 << ',' << encode_finish_ms << ',' << packetization_finish_ms << ',' |
48 << ',' << render_time_ms; | 57 << pacer_exit_ms << ',' << network_timestamp_ms << ',' |
58 << network2_timestamp_ms << ',' << receive_start_ms << ',' | |
59 << receive_finish_ms << ',' << decode_start_ms << ',' | |
60 << decode_finish_ms << ',' << render_time_ms << ", outlier " | |
61 << IsOutlier(); | |
danilchap
2017/08/11 13:51:16
can it be usefull to trace also if frame trigger b
sprang_webrtc
2017/08/11 15:06:33
Done.
| |
62 } | |
49 return out.str(); | 63 return out.str(); |
50 } | 64 } |
51 | 65 |
52 } // namespace webrtc | 66 } // namespace webrtc |
OLD | NEW |