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_
|
|
|
|
|
|
Revert 8599 "Revert 8580 "Unify underlying frame buffer in I420VideoFrame and...""
It's possible to build Chrome on Windows with this patch now.
BUG=1128
> This is unfortunately causing build problems in Chrome on Windows.
>> Unify underlying frame buffer in I420VideoFrame and WebRtcVideoFrame
>>
>> Currently, I420VideoFrame uses three webrtc::Plane to store pixel data, and WebRtcVideoFrame uses WebRtcVideoFrame::FrameBuffer/webrtc::VideoFrame. The two subclasses WebRtcTextureVideoFrame and TextureVideoFrame use a NativeHandle to store pixel data, and there is also a class WebRtcVideoRenderFrame that wraps an I420VideoFrame.
>>
>> This CL replaces these classes with a new interface VideoFrameBuffer that provides the common functionality. This makes it possible to remove deep frame copies between cricket::VideoFrame and I420VideoFrame.
>>
>> Some additional minor changes are:
>> * Disallow creation of 0x0 texture frames.
>> * Remove the half-implemented ref count functions in I420VideoFrame.
>> * Remove the Alias functionality in WebRtcVideoFrame
>>
>> The final goal is to eliminate all frame copies, but to limit the scope of this CL, some planned changes are postponed to follow-up CL:s (see planned changes in https://webrtc-codereview.appspot.com/38879004, or https://docs.google.com/document/d/1bxoJZNmlo-Z9GnQwIaWpEG6hDlL_W-bzka8Zb_K2NbA/preview). Specifically, this CL:
>> * Keeps empty subclasses WebRtcTextureVideoFrame and TextureVideoFrame, and just delegates the construction to the superclass.
>> * Keeps the deep copies from cricket::VideoFrame to I420VideoFrame.
>>
>> BUG=1128
>> R=mflodman@webrtc.org, pbos@webrtc.org, perkj@webrtc.org, tommi@webrtc.org
>>
>> Review URL: https://webrtc-codereview.appspot.com/42469004
R=pbos@webrtc.org
TBR=mflodman, pbos, perkj, tommi
Review URL: https://webrtc-codereview.appspot.com/45489004
Cr-Commit-Position: refs/heads/master@{#8616}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8616 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-05 14:03:08 +00:00
|
|
|
#include "webrtc/base/scoped_ref_ptr.h"
|
2016-09-05 00:51:16 -07:00
|
|
|
#include "webrtc/base/timeutils.h"
|
2015-10-19 02:39:06 -07:00
|
|
|
#include "webrtc/common_types.h"
|
2015-11-16 13:52:24 -08:00
|
|
|
#include "webrtc/common_video/include/video_frame_buffer.h"
|
2015-02-11 18:37:54 +00:00
|
|
|
#include "webrtc/common_video/rotation.h"
|
2015-03-06 10:41:00 +00:00
|
|
|
#include "webrtc/typedefs.h"
|
2014-09-17 09:02:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-05-29 17:21:40 -07:00
|
|
|
class VideoFrame {
|
2014-09-17 09:02:25 +00:00
|
|
|
public:
|
2016-06-22 08:47:49 -07:00
|
|
|
// TODO(nisse): Deprecated. Using the default constructor violates the
|
|
|
|
|
// reasonable assumption that video_frame_buffer() returns a valid buffer.
|
2015-05-29 17:21:40 -07:00
|
|
|
VideoFrame();
|
2016-06-22 08:47:49 -07:00
|
|
|
|
2016-09-05 00:51:16 -07:00
|
|
|
// TODO(nisse): This constructor is consistent with
|
|
|
|
|
// cricket::WebRtcVideoFrame. After the class
|
|
|
|
|
// cricket::WebRtcVideoFrame and its baseclass cricket::VideoFrame
|
|
|
|
|
// are deleted, we should consider whether or not we want to stick
|
|
|
|
|
// to this style and deprecate the other constructors.
|
|
|
|
|
VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
|
|
|
|
|
webrtc::VideoRotation rotation,
|
|
|
|
|
int64_t timestamp_us);
|
|
|
|
|
|
2016-06-22 08:47:49 -07:00
|
|
|
// Preferred constructor.
|
2016-09-05 00:51:16 -07:00
|
|
|
VideoFrame(const rtc::scoped_refptr<VideoFrameBuffer>& buffer,
|
2015-05-29 17:21:40 -07:00
|
|
|
uint32_t timestamp,
|
|
|
|
|
int64_t render_time_ms,
|
|
|
|
|
VideoRotation rotation);
|
2014-09-17 09:02:25 +00:00
|
|
|
|
2016-10-31 08:05:50 -07:00
|
|
|
// Support move and copy.
|
|
|
|
|
VideoFrame(const VideoFrame&) = default;
|
|
|
|
|
VideoFrame(VideoFrame&&) = default;
|
|
|
|
|
VideoFrame& operator=(const VideoFrame&) = default;
|
|
|
|
|
VideoFrame& operator=(VideoFrame&&) = default;
|
2015-03-18 09:51:05 +00:00
|
|
|
|
2014-09-17 09:02:25 +00:00
|
|
|
// Get frame width.
|
2015-03-06 10:41:00 +00:00
|
|
|
int width() const;
|
2014-09-17 09:02:25 +00:00
|
|
|
|
|
|
|
|
// Get frame height.
|
2015-03-06 10:41:00 +00:00
|
|
|
int height() const;
|
2014-09-17 09:02:25 +00:00
|
|
|
|
2016-09-05 00:51:16 -07:00
|
|
|
// System monotonic clock, same timebase as rtc::TimeMicros().
|
|
|
|
|
int64_t timestamp_us() const { return timestamp_us_; }
|
|
|
|
|
void set_timestamp_us(int64_t timestamp_us) {
|
|
|
|
|
timestamp_us_ = timestamp_us;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-22 08:47:49 -07:00
|
|
|
// TODO(nisse): After the cricket::VideoFrame and webrtc::VideoFrame
|
2016-09-05 00:51:16 -07:00
|
|
|
// merge, timestamps other than timestamp_us will likely be
|
|
|
|
|
// deprecated.
|
2016-06-22 08:47:49 -07:00
|
|
|
|
2014-09-17 09:02:25 +00:00
|
|
|
// Set frame timestamp (90kHz).
|
2016-09-05 00:51:16 -07:00
|
|
|
void set_timestamp(uint32_t timestamp) { timestamp_rtp_ = timestamp; }
|
2014-09-17 09:02:25 +00:00
|
|
|
|
|
|
|
|
// Get frame timestamp (90kHz).
|
2016-09-05 00:51:16 -07:00
|
|
|
uint32_t timestamp() const { return timestamp_rtp_; }
|
2014-09-17 09:02:25 +00:00
|
|
|
|
Reland of Make cricket::VideoFrame inherit webrtc::VideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2402853002/ )
This cl now makes cricket::VideoFrame and cricket::WebRtcVideoFrame aliases for webrtc::VideoFrame.
Reason for revert:
Fixing backwards compatibility issues.
Original issue's description:
> Revert of Make cricket::VideoFrame inherit webrtc::VideoFrame. (patchset #9 id:160001 of https://codereview.webrtc.org/2315663002/ )
>
> Reason for revert:
> Breaks compile for Chromium builds:
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/10761
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/18142
>
> FAILED: obj/remoting/protocol/protocol/webrtc_video_renderer_adapter.o
> ../../remoting/protocol/webrtc_video_renderer_adapter.cc:110:52: error: no member named 'transport_frame_id' in 'cricket::VideoFrame'
> weak_factory_.GetWeakPtr(), frame.transport_frame_id(),
> ~~~~~ ^
> 1 error generated.
>
> Please run chromium trybots as described at https://webrtc.org/contributing/#tryjobs-on-chromium-trybots before relanding.
>
> Original issue's description:
> > Make cricket::VideoFrame inherit webrtc::VideoFrame. Delete
> > all methods but a few constructors. And similarly for the
> > subclass cricket::WebRtcVideoFrame.
> >
> > TBR=tkchin@webrtc.org # Added an include line
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/dda6ec008a0fc8d52e118814fb779032e8931968
> > Cr-Commit-Position: refs/heads/master@{#14576}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,pthatcher@chromium.org,tkchin@webrtc.org,nisse@webrtc.org
> NOTRY=True
> NOPRESUBMIT=True
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d36dd499c8f253cbcf37364c2a070c2e8c7100e9
> Cr-Commit-Position: refs/heads/master@{#14583}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,pthatcher@chromium.org,tkchin@webrtc.org,kjellander@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2411953002
Cr-Commit-Position: refs/heads/master@{#14678}
2016-10-19 00:30:30 -07:00
|
|
|
// For now, transport_frame_id and rtp timestamp are the same.
|
|
|
|
|
// TODO(nisse): Must be handled differently for QUIC.
|
|
|
|
|
uint32_t transport_frame_id() const { return timestamp(); }
|
|
|
|
|
|
2016-06-22 08:47:49 -07:00
|
|
|
// Set capture ntp time in milliseconds.
|
2015-03-06 10:41:00 +00:00
|
|
|
void set_ntp_time_ms(int64_t ntp_time_ms) {
|
2014-09-17 09:02:25 +00:00
|
|
|
ntp_time_ms_ = ntp_time_ms;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-22 08:47:49 -07:00
|
|
|
// Get capture ntp time in milliseconds.
|
2015-03-06 10:41:00 +00:00
|
|
|
int64_t ntp_time_ms() const { return ntp_time_ms_; }
|
2014-09-17 09:02:25 +00:00
|
|
|
|
2015-02-11 18:37:54 +00:00
|
|
|
// Naming convention for Coordination of Video Orientation. Please see
|
|
|
|
|
// http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ts_126114v120700p.pdf
|
|
|
|
|
//
|
|
|
|
|
// "pending rotation" or "pending" = a frame that has a VideoRotation > 0.
|
|
|
|
|
//
|
|
|
|
|
// "not pending" = a frame that has a VideoRotation == 0.
|
|
|
|
|
//
|
|
|
|
|
// "apply rotation" = modify a frame from being "pending" to being "not
|
|
|
|
|
// pending" rotation (a no-op for "unrotated").
|
|
|
|
|
//
|
2015-03-06 10:41:00 +00:00
|
|
|
VideoRotation rotation() const { return rotation_; }
|
|
|
|
|
void set_rotation(VideoRotation rotation) {
|
2015-02-11 18:37:54 +00:00
|
|
|
rotation_ = rotation;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-22 08:47:49 -07:00
|
|
|
// Set render time in milliseconds.
|
2015-03-06 10:41:00 +00:00
|
|
|
void set_render_time_ms(int64_t render_time_ms) {
|
2016-09-05 00:51:16 -07:00
|
|
|
set_timestamp_us(render_time_ms * rtc::kNumMicrosecsPerMillisec);;
|
2014-09-17 09:02:25 +00:00
|
|
|
}
|
|
|
|
|
|
2016-06-22 08:47:49 -07:00
|
|
|
// Get render time in milliseconds.
|
2016-09-05 00:51:16 -07:00
|
|
|
int64_t render_time_ms() const {
|
|
|
|
|
return timestamp_us() / rtc::kNumMicrosecsPerMillisec;
|
|
|
|
|
}
|
2014-09-17 09:02:25 +00:00
|
|
|
|
2016-06-22 08:47:49 -07:00
|
|
|
// Return true if and only if video_frame_buffer() is null. Which is possible
|
|
|
|
|
// only if the object was default-constructed.
|
|
|
|
|
// TODO(nisse): Deprecated. Should be deleted in the cricket::VideoFrame and
|
|
|
|
|
// webrtc::VideoFrame merge. The intention is that video_frame_buffer() never
|
|
|
|
|
// should return nullptr. To handle potentially uninitialized or non-existent
|
|
|
|
|
// frames, consider using rtc::Optional. Otherwise, IsZeroSize() can be
|
|
|
|
|
// replaced by video_frame_buffer() == nullptr.
|
2015-03-06 10:41:00 +00:00
|
|
|
bool IsZeroSize() const;
|
2014-09-17 09:02:25 +00:00
|
|
|
|
2016-04-15 03:43:39 -07:00
|
|
|
// Return the underlying buffer. Never nullptr for a properly
|
|
|
|
|
// initialized VideoFrame.
|
2016-11-10 08:44:38 -08:00
|
|
|
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer() const;
|
2014-09-17 09:02:25 +00:00
|
|
|
|
Avoid unnecessary HW video encoder reconfiguration
This change reduces the number of times the Android hardware video
encoder is reconfigured when making an outgoing call. With this change,
the encoder should only be initialized once as opposed to the ~3 times
it happens currently.
Before the fix, the following sequence of events caused the extra
reconfigurations:
1. After the SetLocalDescription call, the WebRtcVideoSendStream is created.
All frames from the camera are dropped until the corresponding
VideoSendStream is created.
2. SetRemoteDescription() triggers the VideoSendStream creation. At
this point, the encoder is configured for the first time, with the
frame dimensions set to a low resolution default (176x144).
3. When the first video frame is received from the camera after the
VideoSendStreamIsCreated, the encoder is reconfigured to the correct
dimensions. If we are using the Android hardware encoder, the default
configuration is set to encode from a memory buffer (use_surface=false).
4. When the frame is passed down to the encoder in
androidmediaencoder_jni.cc EncodeOnCodecThread(), it may be stored in
a texture instead of a memory buffer. In this case, yet another
reconfiguration takes place to enable encoding from a texture.
5. Even if the resolution and texture flag were known at the start of
the call, there would be a reconfiguration involved if the camera is
rotated (such as when making a call from a phone in portrait orientation).
The reason for that is that at construction time, WebRtcVideoEngine2
sets the VideoSinkWants structure parameter to request frames rotated
by the source; the early frames will then arrive in portrait resolution.
When the remote description is finally set, if the rotation RTP extension
is supported by the remote receiver, the source is asked to provide
non-rotated frames. The very next frame will then arrive in landscape
resolution with a non-zero rotation value to be applied by the receiver.
Since the encoder was configured with the last (portrait) frame size,
it's going to need to be reconfigured again.
The fix makes the following changes:
1. WebRtcVideoSendStream::OnFrame() now caches the last seen frame
dimensions, and whether the frame was stored in a texture.
2. When the encoder is configured the first time
(WebRtcVideoSendStream::SetCodec()) - the last seen frame dimensions
are used instead of the default dimensions.
3. A flag that indicates if encoding is to be done from a texture has
been added to the webrtc::VideoStream and webrtc::VideoCodec structs,
and it's been wired up to be passed down all the way to the JNI code in
androidmediaencoder_jni.cc.
4. MediaCodecVideoEncoder::InitEncode is now reading the is_surface
flag from the VideoCodec structure instead of guessing the default as
false. This way we end up with the correct encoder configuration the
first time around.
5. WebRtcVideoSendStream now takes an optimistic guess and requests non-
rotated frames when the supported RtpExtensions list is not available.
This makes the "early" frames arrive non-rotated, and the cached dimensions
will be correct for the common case when the rotation extension is supported.
If the other side is an older endpoint which does not support rotation,
the encoder will have to be reconfigured - but it's better to penalize the
uncommon case rather than the common one.
Review-Url: https://codereview.webrtc.org/2067103002
Cr-Commit-Position: refs/heads/master@{#13173}
2016-06-16 12:08:03 -07:00
|
|
|
// Return true if the frame is stored in a texture.
|
2016-10-02 23:45:26 -07:00
|
|
|
bool is_texture() const {
|
Avoid unnecessary HW video encoder reconfiguration
This change reduces the number of times the Android hardware video
encoder is reconfigured when making an outgoing call. With this change,
the encoder should only be initialized once as opposed to the ~3 times
it happens currently.
Before the fix, the following sequence of events caused the extra
reconfigurations:
1. After the SetLocalDescription call, the WebRtcVideoSendStream is created.
All frames from the camera are dropped until the corresponding
VideoSendStream is created.
2. SetRemoteDescription() triggers the VideoSendStream creation. At
this point, the encoder is configured for the first time, with the
frame dimensions set to a low resolution default (176x144).
3. When the first video frame is received from the camera after the
VideoSendStreamIsCreated, the encoder is reconfigured to the correct
dimensions. If we are using the Android hardware encoder, the default
configuration is set to encode from a memory buffer (use_surface=false).
4. When the frame is passed down to the encoder in
androidmediaencoder_jni.cc EncodeOnCodecThread(), it may be stored in
a texture instead of a memory buffer. In this case, yet another
reconfiguration takes place to enable encoding from a texture.
5. Even if the resolution and texture flag were known at the start of
the call, there would be a reconfiguration involved if the camera is
rotated (such as when making a call from a phone in portrait orientation).
The reason for that is that at construction time, WebRtcVideoEngine2
sets the VideoSinkWants structure parameter to request frames rotated
by the source; the early frames will then arrive in portrait resolution.
When the remote description is finally set, if the rotation RTP extension
is supported by the remote receiver, the source is asked to provide
non-rotated frames. The very next frame will then arrive in landscape
resolution with a non-zero rotation value to be applied by the receiver.
Since the encoder was configured with the last (portrait) frame size,
it's going to need to be reconfigured again.
The fix makes the following changes:
1. WebRtcVideoSendStream::OnFrame() now caches the last seen frame
dimensions, and whether the frame was stored in a texture.
2. When the encoder is configured the first time
(WebRtcVideoSendStream::SetCodec()) - the last seen frame dimensions
are used instead of the default dimensions.
3. A flag that indicates if encoding is to be done from a texture has
been added to the webrtc::VideoStream and webrtc::VideoCodec structs,
and it's been wired up to be passed down all the way to the JNI code in
androidmediaencoder_jni.cc.
4. MediaCodecVideoEncoder::InitEncode is now reading the is_surface
flag from the VideoCodec structure instead of guessing the default as
false. This way we end up with the correct encoder configuration the
first time around.
5. WebRtcVideoSendStream now takes an optimistic guess and requests non-
rotated frames when the supported RtpExtensions list is not available.
This makes the "early" frames arrive non-rotated, and the cached dimensions
will be correct for the common case when the rotation extension is supported.
If the other side is an older endpoint which does not support rotation,
the encoder will have to be reconfigured - but it's better to penalize the
uncommon case rather than the common one.
Review-Url: https://codereview.webrtc.org/2067103002
Cr-Commit-Position: refs/heads/master@{#13173}
2016-06-16 12:08:03 -07:00
|
|
|
return video_frame_buffer() &&
|
|
|
|
|
video_frame_buffer()->native_handle() != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-17 09:02:25 +00:00
|
|
|
private:
|
Revert 8599 "Revert 8580 "Unify underlying frame buffer in I420VideoFrame and...""
It's possible to build Chrome on Windows with this patch now.
BUG=1128
> This is unfortunately causing build problems in Chrome on Windows.
>> Unify underlying frame buffer in I420VideoFrame and WebRtcVideoFrame
>>
>> Currently, I420VideoFrame uses three webrtc::Plane to store pixel data, and WebRtcVideoFrame uses WebRtcVideoFrame::FrameBuffer/webrtc::VideoFrame. The two subclasses WebRtcTextureVideoFrame and TextureVideoFrame use a NativeHandle to store pixel data, and there is also a class WebRtcVideoRenderFrame that wraps an I420VideoFrame.
>>
>> This CL replaces these classes with a new interface VideoFrameBuffer that provides the common functionality. This makes it possible to remove deep frame copies between cricket::VideoFrame and I420VideoFrame.
>>
>> Some additional minor changes are:
>> * Disallow creation of 0x0 texture frames.
>> * Remove the half-implemented ref count functions in I420VideoFrame.
>> * Remove the Alias functionality in WebRtcVideoFrame
>>
>> The final goal is to eliminate all frame copies, but to limit the scope of this CL, some planned changes are postponed to follow-up CL:s (see planned changes in https://webrtc-codereview.appspot.com/38879004, or https://docs.google.com/document/d/1bxoJZNmlo-Z9GnQwIaWpEG6hDlL_W-bzka8Zb_K2NbA/preview). Specifically, this CL:
>> * Keeps empty subclasses WebRtcTextureVideoFrame and TextureVideoFrame, and just delegates the construction to the superclass.
>> * Keeps the deep copies from cricket::VideoFrame to I420VideoFrame.
>>
>> BUG=1128
>> R=mflodman@webrtc.org, pbos@webrtc.org, perkj@webrtc.org, tommi@webrtc.org
>>
>> Review URL: https://webrtc-codereview.appspot.com/42469004
R=pbos@webrtc.org
TBR=mflodman, pbos, perkj, tommi
Review URL: https://webrtc-codereview.appspot.com/45489004
Cr-Commit-Position: refs/heads/master@{#8616}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8616 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-05 14:03:08 +00:00
|
|
|
// An opaque reference counted handle that stores the pixel data.
|
|
|
|
|
rtc::scoped_refptr<webrtc::VideoFrameBuffer> video_frame_buffer_;
|
2016-09-05 00:51:16 -07:00
|
|
|
uint32_t timestamp_rtp_;
|
2014-09-17 09:02:25 +00:00
|
|
|
int64_t ntp_time_ms_;
|
2016-09-05 00:51:16 -07:00
|
|
|
int64_t timestamp_us_;
|
2015-02-11 18:37:54 +00:00
|
|
|
VideoRotation rotation_;
|
2014-09-17 09:02:25 +00:00
|
|
|
};
|
|
|
|
|
|
2015-10-19 23:32:41 -07:00
|
|
|
|
2014-09-17 09:02:25 +00:00
|
|
|
// 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) {}
|
|
|
|
|
|
2015-10-19 00:35:21 -07:00
|
|
|
struct AdaptReason {
|
|
|
|
|
AdaptReason()
|
2015-10-19 23:32:41 -07:00
|
|
|
: quality_resolution_downscales(-1),
|
|
|
|
|
bw_resolutions_disabled(-1) {}
|
2015-10-19 00:35:21 -07:00
|
|
|
|
|
|
|
|
int quality_resolution_downscales; // Number of times this frame is down
|
|
|
|
|
// scaled in resolution due to quality.
|
|
|
|
|
// Or -1 if information is not provided.
|
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_
|