From f698a39eecd1c58108d56d0b541430deebc74a25 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Thu, 7 Dec 2023 20:42:03 +0100 Subject: [PATCH] OpenH264: report error on unsupported pixel format BUG=webrtc:15713 Change-Id: I32aa14aced59ed8f1a9a3a9b8f70182d704e3354 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/330460 Commit-Queue: Philipp Hancke Reviewed-by: Sergey Silkin Reviewed-by: Natalie Silvanovich Cr-Commit-Position: refs/heads/main@{#41420} --- modules/video_coding/codecs/h264/h264_decoder_impl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/modules/video_coding/codecs/h264/h264_decoder_impl.cc index a9e9926c4f..c6446c25ce 100644 --- a/modules/video_coding/codecs/h264/h264_decoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_decoder_impl.cc @@ -80,7 +80,11 @@ int H264DecoderImpl::AVGetBuffer2(AVCodecContext* context, kPixelFormatsSupported.begin(), kPixelFormatsSupported.end(), [context](AVPixelFormat format) { return context->pix_fmt == format; }); - RTC_CHECK(pixelFormatSupported != kPixelFormatsSupported.end()); + if (pixelFormatSupported == kPixelFormatsSupported.end()) { + RTC_LOG(LS_ERROR) << "Unsupported pixel format: " << context->pix_fmt; + decoder->ReportError(); + return -1; + } // `av_frame->width` and `av_frame->height` are set by FFmpeg. These are the // actual image's dimensions and may be different from `context->width` and