RTC_CHECK frame buffer has expected width & height
The width and height of mapped_buffer must match the d_w and d_h members
of frame_to_encode_, which is passed to aom_codec_encode().
Bug: b:330482827
Change-Id: I85d8c82133768685565f165eafc893c42dc40b12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/345807
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Wan-Teh Chang <wtc@google.com>
Cr-Commit-Position: refs/heads/main@{#42036}
diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
index 37dcb78..0eaea92 100644
--- a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
+++ b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
@@ -626,6 +626,8 @@
MaybeRewrapImgWithFormat(AOM_IMG_FMT_I420);
auto i420_buffer = mapped_buffer->GetI420();
RTC_DCHECK(i420_buffer);
+ RTC_CHECK_EQ(i420_buffer->width(), frame_for_encode_->d_w);
+ RTC_CHECK_EQ(i420_buffer->height(), frame_for_encode_->d_h);
frame_for_encode_->planes[AOM_PLANE_Y] =
const_cast<unsigned char*>(i420_buffer->DataY());
frame_for_encode_->planes[AOM_PLANE_U] =
@@ -641,6 +643,8 @@
MaybeRewrapImgWithFormat(AOM_IMG_FMT_NV12);
const NV12BufferInterface* nv12_buffer = mapped_buffer->GetNV12();
RTC_DCHECK(nv12_buffer);
+ RTC_CHECK_EQ(nv12_buffer->width(), frame_for_encode_->d_w);
+ RTC_CHECK_EQ(nv12_buffer->height(), frame_for_encode_->d_h);
frame_for_encode_->planes[AOM_PLANE_Y] =
const_cast<unsigned char*>(nv12_buffer->DataY());
frame_for_encode_->planes[AOM_PLANE_U] =