1 /* 2 * Copyright (c) 2014 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 COMMON_VIDEO_INCLUDE_VIDEO_FRAME_H_ 12 #define COMMON_VIDEO_INCLUDE_VIDEO_FRAME_H_ 13 14 // TODO(nisse): This header file should eventually be deleted. The 15 // EncodedImage class stays in this file until we have figured out how 16 // to refactor and clean up related interfaces, at which point it 17 // should be moved to somewhere under api/. 18 19 #include "common_types.h" // NOLINT(build/include) 20 #include "typedefs.h" // NOLINT(build/include) 21 22 namespace webrtc { 23 24 // TODO(pbos): Rename EncodedFrame and reformat this class' members. 25 class EncodedImage { 26 public: 27 static const size_t kBufferPaddingBytesH264; 28 29 // Some decoders require encoded image buffers to be padded with a small 30 // number of additional bytes (due to over-reading byte readers). 31 static size_t GetBufferPaddingBytes(VideoCodecType codec_type); 32 33 EncodedImage(); 34 EncodedImage(uint8_t* buffer, size_t length, size_t size); 35 36 void SetEncodeTime(int64_t encode_start_ms, int64_t encode_finish_ms); 37 38 // TODO(kthelgason): get rid of this struct as it only has a single member 39 // remaining. 40 struct AdaptReason { AdaptReasonAdaptReason41 AdaptReason() : bw_resolutions_disabled(-1) {} 42 int bw_resolutions_disabled; // Number of resolutions that are not sent 43 // due to bandwidth for this frame. 44 // Or -1 if information is not provided. 45 }; 46 uint32_t _encodedWidth = 0; 47 uint32_t _encodedHeight = 0; 48 uint32_t _timeStamp = 0; 49 // NTP time of the capture time in local timebase in milliseconds. 50 int64_t ntp_time_ms_ = 0; 51 int64_t capture_time_ms_ = 0; 52 FrameType _frameType = kVideoFrameDelta; 53 uint8_t* _buffer; 54 size_t _length; 55 size_t _size; 56 VideoRotation rotation_ = kVideoRotation_0; 57 VideoContentType content_type_ = VideoContentType::UNSPECIFIED; 58 bool _completeFrame = false; 59 AdaptReason adapt_reason_; 60 int qp_ = -1; // Quantizer value. 61 62 // 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 64 // until the application indicates a change again. 65 PlayoutDelay playout_delay_ = {-1, -1}; 66 67 struct Timing { 68 uint8_t flags = TimingFrameFlags::kInvalid; 69 int64_t encode_start_ms = 0; 70 int64_t encode_finish_ms = 0; 71 int64_t packetization_finish_ms = 0; 72 int64_t pacer_exit_ms = 0; 73 int64_t network_timestamp_ms = 0; 74 int64_t network2_timestamp_ms = 0; 75 int64_t receive_start_ms = 0; 76 int64_t receive_finish_ms = 0; 77 } timing_; 78 }; 79 80 } // namespace webrtc 81 82 #endif // COMMON_VIDEO_INCLUDE_VIDEO_FRAME_H_ 83