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 #ifndef WEBRTC_API_VIDEO_VIDEO_TIMING_H_ | 11 #ifndef WEBRTC_API_VIDEO_VIDEO_TIMING_H_ |
12 #define WEBRTC_API_VIDEO_VIDEO_TIMING_H_ | 12 #define WEBRTC_API_VIDEO_VIDEO_TIMING_H_ |
13 | 13 |
14 #include <stdint.h> | 14 #include <stdint.h> |
15 #include <limits> | 15 |
16 #include <string> | |
17 | |
16 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/safe_conversions.h" | 19 #include "webrtc/base/safe_conversions.h" |
18 | 20 |
19 namespace webrtc { | 21 namespace webrtc { |
20 | 22 |
21 // Video timing timstamps in ms counted from capture_time_ms of a frame. | 23 // Video timing timstamps in ms counted from capture_time_ms of a frame. |
22 struct VideoTiming { | 24 struct VideoSendTiming { |
23 static const uint8_t kEncodeStartDeltaIdx = 0; | 25 static const uint8_t kEncodeStartDeltaIdx = 0; |
24 static const uint8_t kEncodeFinishDeltaIdx = 1; | 26 static const uint8_t kEncodeFinishDeltaIdx = 1; |
25 static const uint8_t kPacketizationFinishDeltaIdx = 2; | 27 static const uint8_t kPacketizationFinishDeltaIdx = 2; |
26 static const uint8_t kPacerExitDeltaIdx = 3; | 28 static const uint8_t kPacerExitDeltaIdx = 3; |
27 static const uint8_t kNetworkTimestampDeltaIdx = 4; | 29 static const uint8_t kNetworkTimestampDeltaIdx = 4; |
28 static const uint8_t kNetwork2TimestampDeltaIdx = 5; | 30 static const uint8_t kNetwork2TimestampDeltaIdx = 5; |
29 | 31 |
30 // Returns |time_ms - base_ms| capped at max 16-bit value. | 32 // Returns |time_ms - base_ms| capped at max 16-bit value. |
31 // Used to fill this data structure as per | 33 // Used to fill this data structure as per |
32 // https://webrtc.org/experiments/rtp-hdrext/video-timing/ extension stores | 34 // https://webrtc.org/experiments/rtp-hdrext/video-timing/ extension stores |
33 // 16-bit deltas of timestamps from packet capture time. | 35 // 16-bit deltas of timestamps from packet capture time. |
34 static uint16_t GetDeltaCappedMs(int64_t base_ms, int64_t time_ms) { | 36 static uint16_t GetDeltaCappedMs(int64_t base_ms, int64_t time_ms) { |
35 RTC_DCHECK_GE(time_ms, base_ms); | 37 RTC_DCHECK_GE(time_ms, base_ms); |
36 return rtc::saturated_cast<uint16_t>(time_ms - base_ms); | 38 return rtc::saturated_cast<uint16_t>(time_ms - base_ms); |
37 } | 39 } |
38 | 40 |
39 uint16_t encode_start_delta_ms; | 41 uint16_t encode_start_delta_ms; |
40 uint16_t encode_finish_delta_ms; | 42 uint16_t encode_finish_delta_ms; |
41 uint16_t packetization_finish_delta_ms; | 43 uint16_t packetization_finish_delta_ms; |
42 uint16_t pacer_exit_delta_ms; | 44 uint16_t pacer_exit_delta_ms; |
43 uint16_t network_timstamp_delta_ms; | 45 uint16_t network_timstamp_delta_ms; |
44 uint16_t network2_timstamp_delta_ms; | 46 uint16_t network2_timstamp_delta_ms; |
45 bool is_timing_frame; | 47 bool is_timing_frame; |
46 }; | 48 }; |
47 | 49 |
50 struct TimingFrameInfo { | |
Taylor Brandstetter
2017/06/25 20:48:03
Can you add a comment (here, or elsewhere in the a
ilnik
2017/06/26 08:46:38
Done.
| |
51 TimingFrameInfo(); | |
52 | |
53 // Returns end-to-end delay of a frame, if sender and receiver timestamps are | |
54 // synchronized, -1 otherwise. | |
55 int64_t EndToEndDelay() const; | |
56 | |
57 // Returns if current frame took longer to process than |other| frame. | |
Taylor Brandstetter
2017/06/25 20:48:03
nit: "Returns true if...", extra space between "pr
ilnik
2017/06/26 08:46:38
Done.
| |
58 // If other frame's clocks are not synchronized, current frame is always | |
59 // preferred. | |
60 bool IsLongerThan(const TimingFrameInfo& other) const; | |
61 | |
62 std::string ToString() const; | |
63 | |
64 uint32_t rtp_timestamp; | |
65 int64_t capture_time_ms; | |
66 int64_t encode_start_ms; | |
67 int64_t encode_finish_ms; | |
68 int64_t packetization_finish_ms; | |
69 int64_t pacer_exit_ms; | |
70 int64_t network_timestamp_ms; | |
71 int64_t network2_timestamp_ms; | |
72 int64_t receive_start_ms; | |
73 int64_t receive_finish_ms; | |
Taylor Brandstetter
2017/06/25 20:48:03
Some of these (mostly the 4 preceding this comment
ilnik
2017/06/26 08:46:38
Done.
| |
74 int64_t decode_start_ms; | |
75 int64_t decode_finish_ms; | |
76 int64_t render_time_ms; | |
77 }; | |
78 | |
48 } // namespace webrtc | 79 } // namespace webrtc |
49 | 80 |
50 #endif // WEBRTC_API_VIDEO_VIDEO_TIMING_H_ | 81 #endif // WEBRTC_API_VIDEO_VIDEO_TIMING_H_ |
OLD | NEW |