2014-09-17 09:02:25 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 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_VIDEO_FRAME_H_
|
|
|
|
|
#define WEBRTC_VIDEO_FRAME_H_
|
|
|
|
|
|
2017-01-10 07:44:26 -08:00
|
|
|
// TODO(nisse): This header file should eventually be deleted. For
|
|
|
|
|
// declarations of classes related to unencoded video frame, use the
|
|
|
|
|
// headers under api/video instead. The EncodedImage class stays in
|
|
|
|
|
// this file until we have figured out how to refactor and clean up
|
|
|
|
|
// related interfaces.
|
|
|
|
|
|
|
|
|
|
#include "webrtc/api/video/video_frame.h"
|
|
|
|
|
#include "webrtc/api/video/i420_buffer.h"
|
2015-10-19 02:39:06 -07:00
|
|
|
#include "webrtc/common_types.h"
|
2015-03-06 10:41:00 +00:00
|
|
|
#include "webrtc/typedefs.h"
|
2014-09-17 09:02:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// TODO(pbos): Rename EncodedFrame and reformat this class' members.
|
|
|
|
|
class EncodedImage {
|
|
|
|
|
public:
|
2016-01-21 05:43:11 -08:00
|
|
|
static const size_t kBufferPaddingBytesH264;
|
|
|
|
|
|
|
|
|
|
// Some decoders require encoded image buffers to be padded with a small
|
|
|
|
|
// number of additional bytes (due to over-reading byte readers).
|
|
|
|
|
static size_t GetBufferPaddingBytes(VideoCodecType codec_type);
|
|
|
|
|
|
2015-03-10 12:55:17 +00:00
|
|
|
EncodedImage() : EncodedImage(nullptr, 0, 0) {}
|
2016-04-19 15:01:23 +02:00
|
|
|
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
EncodedImage(uint8_t* buffer, size_t length, size_t size)
|
2015-03-10 12:55:17 +00:00
|
|
|
: _buffer(buffer), _length(length), _size(size) {}
|
|
|
|
|
|
2016-12-19 06:32:16 -08:00
|
|
|
// TODO(kthelgason): get rid of this struct as it only has a single member
|
|
|
|
|
// remaining.
|
2015-10-19 00:35:21 -07:00
|
|
|
struct AdaptReason {
|
2016-12-19 06:32:16 -08:00
|
|
|
AdaptReason() : bw_resolutions_disabled(-1) {}
|
2015-10-19 23:32:41 -07:00
|
|
|
int bw_resolutions_disabled; // Number of resolutions that are not sent
|
|
|
|
|
// due to bandwidth for this frame.
|
|
|
|
|
// Or -1 if information is not provided.
|
2015-10-19 00:35:21 -07:00
|
|
|
};
|
2015-03-10 12:55:17 +00:00
|
|
|
uint32_t _encodedWidth = 0;
|
|
|
|
|
uint32_t _encodedHeight = 0;
|
|
|
|
|
uint32_t _timeStamp = 0;
|
2014-09-17 09:02:25 +00:00
|
|
|
// NTP time of the capture time in local timebase in milliseconds.
|
2015-03-10 12:55:17 +00:00
|
|
|
int64_t ntp_time_ms_ = 0;
|
|
|
|
|
int64_t capture_time_ms_ = 0;
|
2015-10-23 15:58:18 +02:00
|
|
|
FrameType _frameType = kVideoFrameDelta;
|
2014-09-17 09:02:25 +00:00
|
|
|
uint8_t* _buffer;
|
Use size_t more consistently for packet/payload lengths.
See design doc at https://docs.google.com/a/chromium.org/document/d/1I6nmE9D_BmCY-IoV6MDPY2V6WYpEI-dg2apWXTfZyUI/edit?usp=sharing for more information.
This CL was reviewed and approved in pieces in the following CLs:
https://webrtc-codereview.appspot.com/24209004/
https://webrtc-codereview.appspot.com/24229004/
https://webrtc-codereview.appspot.com/24259004/
https://webrtc-codereview.appspot.com/25109004/
https://webrtc-codereview.appspot.com/26099004/
https://webrtc-codereview.appspot.com/27069004/
https://webrtc-codereview.appspot.com/27969004/
https://webrtc-codereview.appspot.com/27989004/
https://webrtc-codereview.appspot.com/29009004/
https://webrtc-codereview.appspot.com/30929004/
https://webrtc-codereview.appspot.com/30939004/
https://webrtc-codereview.appspot.com/31999004/
Committing as TBR to the original reviewers.
BUG=chromium:81439
TEST=none
TBR=pthatcher,henrik.lundin,tina.legrand,stefan,tkchin,glaznev,kjellander,perkj,mflodman,henrika,asapersson,niklas.enbom
Review URL: https://webrtc-codereview.appspot.com/23129004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7726 4adac7df-926f-26a2-2b94-8c16560cd09d
2014-11-20 22:28:14 +00:00
|
|
|
size_t _length;
|
|
|
|
|
size_t _size;
|
2016-04-19 15:01:23 +02:00
|
|
|
VideoRotation rotation_ = kVideoRotation_0;
|
2015-03-10 12:55:17 +00:00
|
|
|
bool _completeFrame = false;
|
2015-10-19 00:35:21 -07:00
|
|
|
AdaptReason adapt_reason_;
|
2015-10-20 23:55:26 -07:00
|
|
|
int qp_ = -1; // Quantizer value.
|
2016-06-08 00:24:21 -07:00
|
|
|
|
|
|
|
|
// When an application indicates non-zero values here, it is taken as an
|
|
|
|
|
// indication that all future frames will be constrained with those limits
|
|
|
|
|
// until the application indicates a change again.
|
|
|
|
|
PlayoutDelay playout_delay_ = {-1, -1};
|
2014-09-17 09:02:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
#endif // WEBRTC_VIDEO_FRAME_H_
|