Remove deprecated interface in I420BufferInterface::GetI420
Bug: none Change-Id: I55895a360308fd0be79099f2466a7487ef10ce47 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/134463 Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27841}
This commit is contained in:

committed by
Commit Bot

parent
e360c09c86
commit
a8507e359b
@ -14,26 +14,10 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
rtc::scoped_refptr<I420BufferInterface> VideoFrameBuffer::GetI420() {
|
||||
if (type() == Type::kI420 || type() == Type::kI420A) {
|
||||
return static_cast<I420BufferInterface*>(this);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<const I420BufferInterface> VideoFrameBuffer::GetI420()
|
||||
const {
|
||||
if (type() == Type::kI420 || type() == Type::kI420A) {
|
||||
return static_cast<const I420BufferInterface*>(this);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
I420ABufferInterface* VideoFrameBuffer::GetI420A() {
|
||||
RTC_CHECK(type() == Type::kI420A);
|
||||
return static_cast<I420ABufferInterface*>(this);
|
||||
const I420BufferInterface* VideoFrameBuffer::GetI420() const {
|
||||
// Overridden by subclasses that can return an I420 buffer without any
|
||||
// conversion, in particular, I420BufferInterface.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const I420ABufferInterface* VideoFrameBuffer::GetI420A() const {
|
||||
@ -41,21 +25,11 @@ const I420ABufferInterface* VideoFrameBuffer::GetI420A() const {
|
||||
return static_cast<const I420ABufferInterface*>(this);
|
||||
}
|
||||
|
||||
I444BufferInterface* VideoFrameBuffer::GetI444() {
|
||||
RTC_CHECK(type() == Type::kI444);
|
||||
return static_cast<I444BufferInterface*>(this);
|
||||
}
|
||||
|
||||
const I444BufferInterface* VideoFrameBuffer::GetI444() const {
|
||||
RTC_CHECK(type() == Type::kI444);
|
||||
return static_cast<const I444BufferInterface*>(this);
|
||||
}
|
||||
|
||||
I010BufferInterface* VideoFrameBuffer::GetI010() {
|
||||
RTC_CHECK(type() == Type::kI010);
|
||||
return static_cast<I010BufferInterface*>(this);
|
||||
}
|
||||
|
||||
const I010BufferInterface* VideoFrameBuffer::GetI010() const {
|
||||
RTC_CHECK(type() == Type::kI010);
|
||||
return static_cast<const I010BufferInterface*>(this);
|
||||
@ -77,6 +51,10 @@ rtc::scoped_refptr<I420BufferInterface> I420BufferInterface::ToI420() {
|
||||
return this;
|
||||
}
|
||||
|
||||
const I420BufferInterface* I420BufferInterface::GetI420() const {
|
||||
return this;
|
||||
}
|
||||
|
||||
VideoFrameBuffer::Type I420ABufferInterface::type() const {
|
||||
return Type::kI420A;
|
||||
}
|
||||
|
@ -71,18 +71,12 @@ class VideoFrameBuffer : public rtc::RefCountInterface {
|
||||
// WebrtcVideoFrameAdapter in Chrome - it's I420 buffer backed by a shared
|
||||
// memory buffer. Therefore it must have type kNative. Yet, ToI420()
|
||||
// doesn't affect binary data at all. Another example is any I420A buffer.
|
||||
// TODO(magjed): Return raw pointers for GetI420 once deprecated interface is
|
||||
// removed.
|
||||
virtual rtc::scoped_refptr<I420BufferInterface> GetI420();
|
||||
virtual rtc::scoped_refptr<const I420BufferInterface> GetI420() const;
|
||||
virtual const I420BufferInterface* GetI420() const;
|
||||
|
||||
// These functions should only be called if type() is of the correct type.
|
||||
// Calling with a different type will result in a crash.
|
||||
I420ABufferInterface* GetI420A();
|
||||
const I420ABufferInterface* GetI420A() const;
|
||||
I444BufferInterface* GetI444();
|
||||
const I444BufferInterface* GetI444() const;
|
||||
I010BufferInterface* GetI010();
|
||||
const I010BufferInterface* GetI010() const;
|
||||
|
||||
protected:
|
||||
@ -127,6 +121,7 @@ class I420BufferInterface : public PlanarYuv8Buffer {
|
||||
int ChromaHeight() const final;
|
||||
|
||||
rtc::scoped_refptr<I420BufferInterface> ToI420() final;
|
||||
const I420BufferInterface* GetI420() const final;
|
||||
|
||||
protected:
|
||||
~I420BufferInterface() override {}
|
||||
|
@ -320,9 +320,9 @@ TEST(TestVideoFrame, ShallowCopy) {
|
||||
VideoFrame frame2(frame1);
|
||||
|
||||
EXPECT_EQ(frame1.video_frame_buffer(), frame2.video_frame_buffer());
|
||||
rtc::scoped_refptr<I420BufferInterface> yuv1 =
|
||||
const webrtc::I420BufferInterface* yuv1 =
|
||||
frame1.video_frame_buffer()->GetI420();
|
||||
rtc::scoped_refptr<I420BufferInterface> yuv2 =
|
||||
const webrtc::I420BufferInterface* yuv2 =
|
||||
frame2.video_frame_buffer()->GetI420();
|
||||
EXPECT_EQ(yuv1->DataY(), yuv2->DataY());
|
||||
EXPECT_EQ(yuv1->DataU(), yuv2->DataU());
|
||||
|
@ -33,7 +33,7 @@ void VideoObserver::OnFrame(const webrtc::VideoFrame& frame) {
|
||||
|
||||
} else {
|
||||
// The buffer has alpha channel.
|
||||
webrtc::I420ABufferInterface* i420a_buffer = buffer->GetI420A();
|
||||
const webrtc::I420ABufferInterface* i420a_buffer = buffer->GetI420A();
|
||||
|
||||
OnI420FrameReady(i420a_buffer->DataY(), i420a_buffer->DataU(),
|
||||
i420a_buffer->DataV(), i420a_buffer->DataA(),
|
||||
|
@ -283,7 +283,7 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
|
||||
VideoFrame* input_frame =
|
||||
static_cast<VideoFrame*>(av_buffer_get_opaque(av_frame_->buf[0]));
|
||||
RTC_DCHECK(input_frame);
|
||||
rtc::scoped_refptr<webrtc::I420BufferInterface> i420_buffer =
|
||||
const webrtc::I420BufferInterface* i420_buffer =
|
||||
input_frame->video_frame_buffer()->GetI420();
|
||||
RTC_CHECK_EQ(av_frame_->data[kYPlaneIndex], i420_buffer->DataY());
|
||||
RTC_CHECK_EQ(av_frame_->data[kUPlaneIndex], i420_buffer->DataU());
|
||||
|
@ -912,7 +912,8 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
|
||||
|
||||
// Keep reference to buffer until encode completes.
|
||||
rtc::scoped_refptr<I420BufferInterface> i420_buffer;
|
||||
rtc::scoped_refptr<I010BufferInterface> i010_buffer;
|
||||
const I010BufferInterface* i010_buffer;
|
||||
rtc::scoped_refptr<const I010BufferInterface> i010_copy;
|
||||
switch (profile_) {
|
||||
case VP9Profile::kProfile0: {
|
||||
i420_buffer = input_image.video_frame_buffer()->ToI420();
|
||||
@ -935,8 +936,9 @@ int VP9EncoderImpl::Encode(const VideoFrame& input_image,
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
i010_buffer =
|
||||
i010_copy =
|
||||
I010Buffer::Copy(*input_image.video_frame_buffer()->ToI420());
|
||||
i010_buffer = i010_copy.get();
|
||||
}
|
||||
}
|
||||
raw_->planes[VPX_PLANE_Y] = const_cast<uint8_t*>(
|
||||
|
Reference in New Issue
Block a user