OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #ifndef WEBRTC_API_VIDEO_VIDEO_TIMING_H_ | |
12 #define WEBRTC_API_VIDEO_VIDEO_TIMING_H_ | |
13 | |
14 #include <stdint.h> | |
15 #include <limits> | |
16 #include "webrtc/base/checks.h" | |
17 | |
18 namespace webrtc { | |
19 | |
20 // Video timing timstamps in ms counted from capture_time_ms of a frame. | |
21 struct VideoTiming { | |
22 static const uint8_t kEncodeStartDeltaIdx = 0; | |
23 static const uint8_t kEncodeFinishIdx = 1; | |
24 static const uint8_t kPacketizationFinishDeltaIdx = 2; | |
25 static const uint8_t kPacerExitDeltaIdx = 3; | |
26 static const uint8_t kNetworkTimestampDeltaIdx = 4; | |
27 | |
28 static uint16_t GetDeltaMs(uint64_t base_ms, uint64_t time_ms) { | |
29 RTC_DCHECK_GE(time_ms, base_ms); | |
30 uint64_t delta = time_ms - base_ms; | |
31 if (delta > std::numeric_limits<uint16_t>::max()) | |
32 delta = std::numeric_limits<uint16_t>::max(); | |
33 return static_cast<uint16_t>(delta); | |
34 } | |
sprang_webrtc
2017/05/31 11:12:54
I'm not sure this is the right place for this? Can
ilnik
2017/05/31 15:17:44
It's called by "modules/rtp_rtcp/source/rtp_packet
nisse-webrtc
2017/06/02 12:10:47
There's also rtc::SafeMin and rtc::SafeMax (added
kwiberg-webrtc
2017/06/02 12:37:12
Yes---those will accept any two integer types, and
ilnik
2017/06/02 14:00:46
Done.
| |
35 | |
36 uint16_t encode_start_ms_delta; | |
37 uint16_t encode_finish_ms_delta; | |
38 uint16_t packetization_finish_ms_delta; | |
39 uint16_t pacer_exit_ms_delta; | |
40 uint16_t network_timstamp_ms_delta; | |
41 bool is_timing_frame; | |
42 }; | |
43 | |
44 } // namespace webrtc | |
45 | |
46 #endif // WEBRTC_API_VIDEO_VIDEO_TIMING_H_ | |
OLD | NEW |