OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Some decoders require encoded image buffers to be padded with a small | 29 // Some decoders require encoded image buffers to be padded with a small |
30 // number of additional bytes (due to over-reading byte readers). | 30 // number of additional bytes (due to over-reading byte readers). |
31 static size_t GetBufferPaddingBytes(VideoCodecType codec_type); | 31 static size_t GetBufferPaddingBytes(VideoCodecType codec_type); |
32 | 32 |
33 EncodedImage() : EncodedImage(nullptr, 0, 0) {} | 33 EncodedImage() : EncodedImage(nullptr, 0, 0) {} |
34 | 34 |
35 EncodedImage(uint8_t* buffer, size_t length, size_t size) | 35 EncodedImage(uint8_t* buffer, size_t length, size_t size) |
36 : _buffer(buffer), _length(length), _size(size) {} | 36 : _buffer(buffer), _length(length), _size(size) {} |
37 | 37 |
| 38 void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms) const { |
| 39 timing_.is_timing_frame = true; |
| 40 timing_.encode_start_ms = encode_start_ms; |
| 41 timing_.encode_finish_ms = encode_finish_ms; |
| 42 } |
| 43 |
38 // TODO(kthelgason): get rid of this struct as it only has a single member | 44 // TODO(kthelgason): get rid of this struct as it only has a single member |
39 // remaining. | 45 // remaining. |
40 struct AdaptReason { | 46 struct AdaptReason { |
41 AdaptReason() : bw_resolutions_disabled(-1) {} | 47 AdaptReason() : bw_resolutions_disabled(-1) {} |
42 int bw_resolutions_disabled; // Number of resolutions that are not sent | 48 int bw_resolutions_disabled; // Number of resolutions that are not sent |
43 // due to bandwidth for this frame. | 49 // due to bandwidth for this frame. |
44 // Or -1 if information is not provided. | 50 // Or -1 if information is not provided. |
45 }; | 51 }; |
46 uint32_t _encodedWidth = 0; | 52 uint32_t _encodedWidth = 0; |
47 uint32_t _encodedHeight = 0; | 53 uint32_t _encodedHeight = 0; |
48 uint32_t _timeStamp = 0; | 54 uint32_t _timeStamp = 0; |
49 // NTP time of the capture time in local timebase in milliseconds. | 55 // NTP time of the capture time in local timebase in milliseconds. |
50 int64_t ntp_time_ms_ = 0; | 56 int64_t ntp_time_ms_ = 0; |
51 int64_t capture_time_ms_ = 0; | 57 int64_t capture_time_ms_ = 0; |
52 FrameType _frameType = kVideoFrameDelta; | 58 FrameType _frameType = kVideoFrameDelta; |
53 uint8_t* _buffer; | 59 uint8_t* _buffer; |
54 size_t _length; | 60 size_t _length; |
55 size_t _size; | 61 size_t _size; |
56 VideoRotation rotation_ = kVideoRotation_0; | 62 VideoRotation rotation_ = kVideoRotation_0; |
57 VideoContentType content_type_ = VideoContentType::UNSPECIFIED; | 63 VideoContentType content_type_ = VideoContentType::UNSPECIFIED; |
58 bool _completeFrame = false; | 64 bool _completeFrame = false; |
59 AdaptReason adapt_reason_; | 65 AdaptReason adapt_reason_; |
60 int qp_ = -1; // Quantizer value. | 66 int qp_ = -1; // Quantizer value. |
61 | 67 |
62 // When an application indicates non-zero values here, it is taken as an | 68 // When an application indicates non-zero values here, it is taken as an |
63 // indication that all future frames will be constrained with those limits | 69 // indication that all future frames will be constrained with those limits |
64 // until the application indicates a change again. | 70 // until the application indicates a change again. |
65 PlayoutDelay playout_delay_ = {-1, -1}; | 71 PlayoutDelay playout_delay_ = {-1, -1}; |
| 72 |
| 73 // Timing information should be updatable on const instances. |
| 74 mutable struct Timing { |
| 75 bool is_timing_frame = false; |
| 76 int64_t encode_start_ms = 0; |
| 77 int64_t encode_finish_ms = 0; |
| 78 int64_t packetization_finish_ms = 0; |
| 79 int64_t pacer_exit_ms = 0; |
| 80 int64_t network_timestamp_ms = 0; |
| 81 int64_t network2_timestamp_ms = 0; |
| 82 int64_t receive_start_ms = 0; |
| 83 int64_t receive_finish_ms = 0; |
| 84 } timing_; |
66 }; | 85 }; |
67 | 86 |
68 } // namespace webrtc | 87 } // namespace webrtc |
69 | 88 |
70 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_H_ | 89 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_VIDEO_FRAME_H_ |
OLD | NEW |