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
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2015 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.
|
|
|
|
|
*/
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "common_video/include/video_frame_buffer.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
|
|
|
|
2017-11-13 10:19:58 +01:00
|
|
|
#include "api/video/i420_buffer.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "rtc_base/checks.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "rtc_base/ref_counted_object.h"
|
2017-12-11 09:32:13 +01:00
|
|
|
#include "third_party/libyuv/include/libyuv/convert.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
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2017-11-13 10:19:58 +01:00
|
|
|
namespace {
|
2015-04-02 12:30:51 +02:00
|
|
|
|
2017-06-22 20:28:06 -07:00
|
|
|
// Template to implement a wrapped buffer for a I4??BufferInterface.
|
|
|
|
|
template <typename Base>
|
|
|
|
|
class WrappedYuvBuffer : public Base {
|
|
|
|
|
public:
|
|
|
|
|
WrappedYuvBuffer(int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint8_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint8_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint8_t* v_plane,
|
|
|
|
|
int v_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used)
|
2017-06-22 20:28:06 -07:00
|
|
|
: width_(width),
|
|
|
|
|
height_(height),
|
|
|
|
|
y_plane_(y_plane),
|
|
|
|
|
u_plane_(u_plane),
|
|
|
|
|
v_plane_(v_plane),
|
|
|
|
|
y_stride_(y_stride),
|
|
|
|
|
u_stride_(u_stride),
|
|
|
|
|
v_stride_(v_stride),
|
|
|
|
|
no_longer_used_cb_(no_longer_used) {}
|
|
|
|
|
|
2017-11-09 12:33:24 -08:00
|
|
|
~WrappedYuvBuffer() override { no_longer_used_cb_(); }
|
|
|
|
|
|
2017-06-22 20:28:06 -07:00
|
|
|
int width() const override { return width_; }
|
|
|
|
|
|
|
|
|
|
int height() const override { return height_; }
|
|
|
|
|
|
|
|
|
|
const uint8_t* DataY() const override { return y_plane_; }
|
|
|
|
|
|
|
|
|
|
const uint8_t* DataU() const override { return u_plane_; }
|
|
|
|
|
|
|
|
|
|
const uint8_t* DataV() const override { return v_plane_; }
|
|
|
|
|
|
|
|
|
|
int StrideY() const override { return y_stride_; }
|
|
|
|
|
|
|
|
|
|
int StrideU() const override { return u_stride_; }
|
|
|
|
|
|
|
|
|
|
int StrideV() const override { return v_stride_; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
friend class rtc::RefCountedObject<WrappedYuvBuffer>;
|
|
|
|
|
|
|
|
|
|
const int width_;
|
|
|
|
|
const int height_;
|
|
|
|
|
const uint8_t* const y_plane_;
|
|
|
|
|
const uint8_t* const u_plane_;
|
|
|
|
|
const uint8_t* const v_plane_;
|
|
|
|
|
const int y_stride_;
|
|
|
|
|
const int u_stride_;
|
|
|
|
|
const int v_stride_;
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used_cb_;
|
2017-06-22 20:28:06 -07:00
|
|
|
};
|
|
|
|
|
|
2017-11-09 12:33:24 -08:00
|
|
|
// Template to implement a wrapped buffer for a I4??BufferInterface.
|
|
|
|
|
template <typename BaseWithA>
|
|
|
|
|
class WrappedYuvaBuffer : public WrappedYuvBuffer<BaseWithA> {
|
|
|
|
|
public:
|
|
|
|
|
WrappedYuvaBuffer(int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint8_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint8_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint8_t* v_plane,
|
|
|
|
|
int v_stride,
|
|
|
|
|
const uint8_t* a_plane,
|
|
|
|
|
int a_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used)
|
2017-11-09 12:33:24 -08:00
|
|
|
: WrappedYuvBuffer<BaseWithA>(width,
|
|
|
|
|
height,
|
|
|
|
|
y_plane,
|
|
|
|
|
y_stride,
|
|
|
|
|
u_plane,
|
|
|
|
|
u_stride,
|
|
|
|
|
v_plane,
|
|
|
|
|
v_stride,
|
|
|
|
|
no_longer_used),
|
|
|
|
|
a_plane_(a_plane),
|
|
|
|
|
a_stride_(a_stride) {}
|
|
|
|
|
|
|
|
|
|
const uint8_t* DataA() const override { return a_plane_; }
|
|
|
|
|
int StrideA() const override { return a_stride_; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const uint8_t* const a_plane_;
|
|
|
|
|
const int a_stride_;
|
|
|
|
|
};
|
|
|
|
|
|
2017-11-13 10:19:58 +01:00
|
|
|
class I444BufferBase : public I444BufferInterface {
|
|
|
|
|
public:
|
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> ToI420() final;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> I444BufferBase::ToI420() {
|
|
|
|
|
rtc::scoped_refptr<I420Buffer> i420_buffer =
|
|
|
|
|
I420Buffer::Create(width(), height());
|
|
|
|
|
libyuv::I444ToI420(DataY(), StrideY(), DataU(), StrideU(), DataV(), StrideV(),
|
|
|
|
|
i420_buffer->MutableDataY(), i420_buffer->StrideY(),
|
|
|
|
|
i420_buffer->MutableDataU(), i420_buffer->StrideU(),
|
|
|
|
|
i420_buffer->MutableDataV(), i420_buffer->StrideV(),
|
|
|
|
|
width(), height());
|
|
|
|
|
return i420_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 09:04:09 +01:00
|
|
|
class I422BufferBase : public I422BufferInterface {
|
|
|
|
|
public:
|
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> ToI420() final;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> I422BufferBase::ToI420() {
|
|
|
|
|
rtc::scoped_refptr<I420Buffer> i420_buffer =
|
|
|
|
|
I420Buffer::Create(width(), height());
|
|
|
|
|
libyuv::I422ToI420(DataY(), StrideY(), DataU(), StrideU(), DataV(), StrideV(),
|
|
|
|
|
i420_buffer->MutableDataY(), i420_buffer->StrideY(),
|
|
|
|
|
i420_buffer->MutableDataU(), i420_buffer->StrideU(),
|
|
|
|
|
i420_buffer->MutableDataV(), i420_buffer->StrideV(),
|
|
|
|
|
width(), height());
|
|
|
|
|
return i420_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-26 12:22:38 -07:00
|
|
|
// Template to implement a wrapped buffer for a PlanarYuv16BBuffer.
|
|
|
|
|
template <typename Base>
|
|
|
|
|
class WrappedYuv16BBuffer : public Base {
|
|
|
|
|
public:
|
|
|
|
|
WrappedYuv16BBuffer(int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint16_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint16_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint16_t* v_plane,
|
|
|
|
|
int v_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used)
|
2018-06-26 12:22:38 -07:00
|
|
|
: width_(width),
|
|
|
|
|
height_(height),
|
|
|
|
|
y_plane_(y_plane),
|
|
|
|
|
u_plane_(u_plane),
|
|
|
|
|
v_plane_(v_plane),
|
|
|
|
|
y_stride_(y_stride),
|
|
|
|
|
u_stride_(u_stride),
|
|
|
|
|
v_stride_(v_stride),
|
|
|
|
|
no_longer_used_cb_(no_longer_used) {}
|
|
|
|
|
|
|
|
|
|
~WrappedYuv16BBuffer() override { no_longer_used_cb_(); }
|
|
|
|
|
|
|
|
|
|
int width() const override { return width_; }
|
|
|
|
|
|
|
|
|
|
int height() const override { return height_; }
|
|
|
|
|
|
|
|
|
|
const uint16_t* DataY() const override { return y_plane_; }
|
|
|
|
|
|
|
|
|
|
const uint16_t* DataU() const override { return u_plane_; }
|
|
|
|
|
|
|
|
|
|
const uint16_t* DataV() const override { return v_plane_; }
|
|
|
|
|
|
|
|
|
|
int StrideY() const override { return y_stride_; }
|
|
|
|
|
|
|
|
|
|
int StrideU() const override { return u_stride_; }
|
|
|
|
|
|
|
|
|
|
int StrideV() const override { return v_stride_; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
friend class rtc::RefCountedObject<WrappedYuv16BBuffer>;
|
|
|
|
|
|
|
|
|
|
const int width_;
|
|
|
|
|
const int height_;
|
|
|
|
|
const uint16_t* const y_plane_;
|
|
|
|
|
const uint16_t* const u_plane_;
|
|
|
|
|
const uint16_t* const v_plane_;
|
|
|
|
|
const int y_stride_;
|
|
|
|
|
const int u_stride_;
|
|
|
|
|
const int v_stride_;
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used_cb_;
|
2018-06-26 12:22:38 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class I010BufferBase : public I010BufferInterface {
|
|
|
|
|
public:
|
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> ToI420() final;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<I420BufferInterface> I010BufferBase::ToI420() {
|
|
|
|
|
rtc::scoped_refptr<I420Buffer> i420_buffer =
|
|
|
|
|
I420Buffer::Create(width(), height());
|
|
|
|
|
libyuv::I010ToI420(DataY(), StrideY(), DataU(), StrideU(), DataV(), StrideV(),
|
|
|
|
|
i420_buffer->MutableDataY(), i420_buffer->StrideY(),
|
|
|
|
|
i420_buffer->MutableDataU(), i420_buffer->StrideU(),
|
|
|
|
|
i420_buffer->MutableDataV(), i420_buffer->StrideV(),
|
|
|
|
|
width(), height());
|
|
|
|
|
return i420_buffer;
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-13 10:19:58 +01:00
|
|
|
} // namespace
|
|
|
|
|
|
2017-06-22 20:28:06 -07:00
|
|
|
rtc::scoped_refptr<I420BufferInterface> WrapI420Buffer(
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint8_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint8_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint8_t* v_plane,
|
|
|
|
|
int v_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used) {
|
2017-06-22 20:28:06 -07:00
|
|
|
return rtc::scoped_refptr<I420BufferInterface>(
|
2021-04-22 19:21:43 +02:00
|
|
|
rtc::make_ref_counted<WrappedYuvBuffer<I420BufferInterface>>(
|
2017-06-22 20:28:06 -07:00
|
|
|
width, height, y_plane, y_stride, u_plane, u_stride, v_plane,
|
|
|
|
|
v_stride, no_longer_used));
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-09 12:33:24 -08:00
|
|
|
rtc::scoped_refptr<I420ABufferInterface> WrapI420ABuffer(
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint8_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint8_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint8_t* v_plane,
|
|
|
|
|
int v_stride,
|
|
|
|
|
const uint8_t* a_plane,
|
|
|
|
|
int a_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used) {
|
2017-11-09 12:33:24 -08:00
|
|
|
return rtc::scoped_refptr<I420ABufferInterface>(
|
2021-04-22 19:21:43 +02:00
|
|
|
rtc::make_ref_counted<WrappedYuvaBuffer<I420ABufferInterface>>(
|
2017-11-09 12:33:24 -08:00
|
|
|
width, height, y_plane, y_stride, u_plane, u_stride, v_plane,
|
|
|
|
|
v_stride, a_plane, a_stride, no_longer_used));
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 09:04:09 +01:00
|
|
|
rtc::scoped_refptr<I422BufferInterface> WrapI422Buffer(
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint8_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint8_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint8_t* v_plane,
|
|
|
|
|
int v_stride,
|
|
|
|
|
std::function<void()> no_longer_used) {
|
|
|
|
|
return rtc::scoped_refptr<I422BufferBase>(
|
|
|
|
|
rtc::make_ref_counted<WrappedYuvBuffer<I422BufferBase>>(
|
|
|
|
|
width, height, y_plane, y_stride, u_plane, u_stride, v_plane,
|
|
|
|
|
v_stride, no_longer_used));
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-22 20:28:06 -07:00
|
|
|
rtc::scoped_refptr<I444BufferInterface> WrapI444Buffer(
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint8_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint8_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint8_t* v_plane,
|
|
|
|
|
int v_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used) {
|
2017-06-22 20:28:06 -07:00
|
|
|
return rtc::scoped_refptr<I444BufferInterface>(
|
2021-04-22 19:21:43 +02:00
|
|
|
rtc::make_ref_counted<WrappedYuvBuffer<I444BufferBase>>(
|
2017-06-22 20:28:06 -07:00
|
|
|
width, height, y_plane, y_stride, u_plane, u_stride, v_plane,
|
|
|
|
|
v_stride, no_longer_used));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rtc::scoped_refptr<PlanarYuvBuffer> WrapYuvBuffer(
|
|
|
|
|
VideoFrameBuffer::Type type,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint8_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint8_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint8_t* v_plane,
|
|
|
|
|
int v_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used) {
|
2017-06-22 20:28:06 -07:00
|
|
|
switch (type) {
|
|
|
|
|
case VideoFrameBuffer::Type::kI420:
|
|
|
|
|
return WrapI420Buffer(width, height, y_plane, y_stride, u_plane, u_stride,
|
|
|
|
|
v_plane, v_stride, no_longer_used);
|
2022-03-25 09:04:09 +01:00
|
|
|
case VideoFrameBuffer::Type::kI422:
|
|
|
|
|
return WrapI422Buffer(width, height, y_plane, y_stride, u_plane, u_stride,
|
|
|
|
|
v_plane, v_stride, no_longer_used);
|
2017-06-22 20:28:06 -07:00
|
|
|
case VideoFrameBuffer::Type::kI444:
|
|
|
|
|
return WrapI444Buffer(width, height, y_plane, y_stride, u_plane, u_stride,
|
|
|
|
|
v_plane, v_stride, no_longer_used);
|
|
|
|
|
default:
|
2020-11-17 14:50:54 +01:00
|
|
|
RTC_CHECK_NOTREACHED();
|
2017-06-22 20:28:06 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-26 12:22:38 -07:00
|
|
|
rtc::scoped_refptr<I010BufferInterface> WrapI010Buffer(
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
const uint16_t* y_plane,
|
|
|
|
|
int y_stride,
|
|
|
|
|
const uint16_t* u_plane,
|
|
|
|
|
int u_stride,
|
|
|
|
|
const uint16_t* v_plane,
|
|
|
|
|
int v_stride,
|
2021-02-02 11:37:39 +01:00
|
|
|
std::function<void()> no_longer_used) {
|
2018-06-26 12:22:38 -07:00
|
|
|
return rtc::scoped_refptr<I010BufferInterface>(
|
2021-04-22 19:21:43 +02:00
|
|
|
rtc::make_ref_counted<WrappedYuv16BBuffer<I010BufferBase>>(
|
2018-06-26 12:22:38 -07:00
|
|
|
width, height, y_plane, y_stride, u_plane, u_stride, v_plane,
|
|
|
|
|
v_stride, no_longer_used));
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
} // namespace webrtc
|