From ef16abac3eb13bf11a4d387cc21b2ffb3046a72b Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Fri, 5 Apr 2024 20:25:25 -0700 Subject: [PATCH] RTC_CHECK frame buffer has expected width & height MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Erik Språng Commit-Queue: Wan-Teh Chang Cr-Commit-Position: refs/heads/main@{#42036} --- modules/video_coding/codecs/av1/libaom_av1_encoder.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/video_coding/codecs/av1/libaom_av1_encoder.cc b/modules/video_coding/codecs/av1/libaom_av1_encoder.cc index 37dcb787c4..0eaea9275d 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 @@ int32_t LibaomAv1Encoder::Encode( 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(i420_buffer->DataY()); frame_for_encode_->planes[AOM_PLANE_U] = @@ -641,6 +643,8 @@ int32_t LibaomAv1Encoder::Encode( 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(nv12_buffer->DataY()); frame_for_encode_->planes[AOM_PLANE_U] =