From 09ed82db6551de38ecd44a0f86d5970c4bf53610 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 2 Apr 2022 16:16:40 -0500 Subject: [PATCH] Fix build with HAVE_MMAL --- app/streaming/video/ffmpeg.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index 7848f775..82d1ef55 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -762,10 +762,15 @@ bool FFmpegVideoDecoder::tryInitializeRendererForDecoderByName(const char *decod // HACK: Avoid using YUV420P on h264_mmal. It can cause a deadlock inside the MMAL libraries. // Even if it didn't completely deadlock us, the performance would likely be atrocious. if (strcmp(decoderName, "h264_mmal") == 0) { - TRY_PREFERRED_PIXEL_FORMAT(MmalRenderer); - TRY_SUPPORTED_NON_PREFERRED_PIXEL_FORMAT(MmalRenderer); + for (int i = 0; decoder->pix_fmts[i] != AV_PIX_FMT_NONE; i++) { + TRY_PREFERRED_PIXEL_FORMAT(MmalRenderer); + } - // Give up if we can't use MmalRenderer + for (int i = 0; decoder->pix_fmts[i] != AV_PIX_FMT_NONE; i++) { + TRY_SUPPORTED_NON_PREFERRED_PIXEL_FORMAT(MmalRenderer); + } + + // Give up if we can't use MmalRenderer for h264_mmal return false; } #endif