Chromium Code Reviews| Index: webrtc/api/video/video_timing.h |
| diff --git a/webrtc/api/video/video_timing.h b/webrtc/api/video/video_timing.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..73767c956752c3607a1be15751f0d285ec2ffc32 |
| --- /dev/null |
| +++ b/webrtc/api/video/video_timing.h |
| @@ -0,0 +1,46 @@ |
| +/* |
| + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_API_VIDEO_VIDEO_TIMING_H_ |
| +#define WEBRTC_API_VIDEO_VIDEO_TIMING_H_ |
| + |
| +#include <stdint.h> |
| +#include <limits> |
| +#include "webrtc/base/checks.h" |
| + |
| +namespace webrtc { |
| + |
| +// Video timing timstamps in ms counted from capture_time_ms of a frame. |
| +struct VideoTiming { |
| + static const uint8_t kEncodeStartDeltaIdx = 0; |
| + static const uint8_t kEncodeFinishIdx = 1; |
| + static const uint8_t kPacketizationFinishDeltaIdx = 2; |
| + static const uint8_t kPacerExitDeltaIdx = 3; |
| + static const uint8_t kNetworkTimestampDeltaIdx = 4; |
| + |
| + static uint16_t GetDeltaMs(uint64_t base_ms, uint64_t time_ms) { |
| + RTC_DCHECK_GE(time_ms, base_ms); |
| + uint64_t delta = time_ms - base_ms; |
| + if (delta > std::numeric_limits<uint16_t>::max()) |
| + delta = std::numeric_limits<uint16_t>::max(); |
| + return static_cast<uint16_t>(delta); |
| + } |
|
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.
|
| + |
| + uint16_t encode_start_ms_delta; |
| + uint16_t encode_finish_ms_delta; |
| + uint16_t packetization_finish_ms_delta; |
| + uint16_t pacer_exit_ms_delta; |
| + uint16_t network_timstamp_ms_delta; |
| + bool is_timing_frame; |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_API_VIDEO_VIDEO_TIMING_H_ |