Add support for I444 in VideoFrameBuffer

VideoFrameBuffer is currently hard coded to be either I420 or Native.
This CL makes VideoFrameBuffer more generic by moving the I420 specific
functions into their own class, and adds an enum tag that represents the
format and storage type of the buffer. Each buffer type is then
represented as a subclass. See webrtc/api/video/video_frame_buffer.h for
more info.

This CL also adds support for representing I444 in VideoFrameBuffer
using the new interface. Possible future buffer type candidates are
RGB and NV12.

BUG=webrtc:7632
TBR=stefan@webrtc.org

Review-Url: https://codereview.webrtc.org/2847383002
Cr-Commit-Position: refs/heads/master@{#18098}
This commit is contained in:
magjed
2017-05-11 05:11:57 -07:00
committed by Commit bot
parent 28e9433b95
commit 712338eed2
7 changed files with 247 additions and 39 deletions

View File

@ -30,6 +30,10 @@ NativeHandleBuffer::NativeHandleBuffer(void* native_handle,
RTC_DCHECK_GT(height, 0);
}
VideoFrameBuffer::Type NativeHandleBuffer::type() const {
return Type::kNative;
}
int NativeHandleBuffer::width() const {
return width_;
}
@ -92,6 +96,10 @@ WrappedI420Buffer::~WrappedI420Buffer() {
no_longer_used_cb_();
}
VideoFrameBuffer::Type WrappedI420Buffer::type() const {
return Type::kI420;
}
int WrappedI420Buffer::width() const {
return width_;
}
@ -120,13 +128,4 @@ int WrappedI420Buffer::StrideV() const {
return v_stride_;
}
void* WrappedI420Buffer::native_handle() const {
return nullptr;
}
rtc::scoped_refptr<VideoFrameBuffer> WrappedI420Buffer::NativeToI420Buffer() {
RTC_NOTREACHED();
return nullptr;
}
} // namespace webrtc