Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: webrtc/api/video/video_timing.h

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Fix capture timestamp issues which cause capture time from the future Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // Returns |time_ms - base_ms| capped at max 16-bit value.
29 // Used to fill this data structure as per
30 // https://webrtc.org/experiments/rtp-hdrext/video-timing/ extension stores
31 // 16-bit deltas of timestamps from packet capture time.
32 static uint16_t GetDeltaCappedMs(int64_t base_ms, int64_t time_ms) {
33 RTC_DCHECK_GE(time_ms, base_ms);
ilnik 2017/06/01 12:33:37 Is this a good idea to crash here in debug? Should
34 int64_t delta = time_ms - base_ms;
35 if (delta > std::numeric_limits<uint16_t>::max())
36 delta = std::numeric_limits<uint16_t>::max();
37 return static_cast<uint16_t>(delta);
38 }
39
40 uint16_t encode_start_ms_delta;
41 uint16_t encode_finish_ms_delta;
42 uint16_t packetization_finish_ms_delta;
43 uint16_t pacer_exit_ms_delta;
44 uint16_t network_timstamp_ms_delta;
45 bool is_timing_frame;
46 };
47
48 } // namespace webrtc
49
50 #endif // WEBRTC_API_VIDEO_VIDEO_TIMING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698