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 <phancke@microsoft.com>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Natalie Silvanovich <natashenka@google.com>
Cr-Commit-Position: refs/heads/main@{#41420}
This commit is contained in:
Philipp Hancke 2023-12-07 20:42:03 +01:00 committed by WebRTC LUCI CQ
parent 5692649b9b
commit f698a39eec

View File

@ -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