From 38f1d4bf8ae27b3e9c7b7a3457ba8d4495974c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Tue, 18 May 2021 11:56:52 +0200 Subject: [PATCH] [LibvpxVp8Encoder] Don't DCHECK crash if I420 is not equal to I420A. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In CL https://webrtc-review.googlesource.com/c/src/+/216323 we fixed the issue where I420 and I420A not being equal would result in dropping frames in release builds. But we forgot to update the corresponding DCHECK, meaning the I420 not being the same as I420A issue still causes crashes on debug builds. (I must have been running a release build not to catch this before?) This CL replaces the DCHECK_EQ with an RTC_NOTREACHED inside the IsCompatibleVideoFrameBufferType check. Because this only affects debug builds, this CL does not need to be backmerged anywhere. Bug: chromium:1203206 Change-Id: I101823e8bca293e94d0f7ce507fe78cedff3ea1b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/219281 Reviewed-by: Ilya Nikolaevskiy Commit-Queue: Henrik Boström Cr-Commit-Position: refs/heads/master@{#34048} --- modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc index 6a8a90169f..dd72872ed8 100644 --- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc +++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc @@ -1388,8 +1388,6 @@ LibvpxVp8Encoder::PrepareBuffers(rtc::scoped_refptr buffer) { } scaled_buffer = mapped_scaled_buffer; } - RTC_DCHECK_EQ(scaled_buffer->type(), mapped_buffer->type()) - << "Scaled frames must have the same type as the mapped frame."; if (!IsCompatibleVideoFrameBufferType(scaled_buffer->type(), mapped_buffer->type())) { RTC_LOG(LS_ERROR) << "When scaling " @@ -1399,6 +1397,10 @@ LibvpxVp8Encoder::PrepareBuffers(rtc::scoped_refptr buffer) { << " instead of " << VideoFrameBufferTypeToString(mapped_buffer->type()) << ". Can't encode frame."; + RTC_NOTREACHED() << "Scaled buffer type " + << VideoFrameBufferTypeToString(scaled_buffer->type()) + << " is not compatible with mapped buffer type " + << VideoFrameBufferTypeToString(mapped_buffer->type()); return {}; } SetRawImagePlanes(&raw_images_[i], scaled_buffer);