From 34f93a6795a1aef8620ff206bdbbdfbbfb3aaef6 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Fri, 22 Jul 2022 14:56:33 +0200 Subject: [PATCH] lavc: sws fallback - use UYVY if none pixfmt avail Use UYVY as a fallback intermediate if no eligible pixfmt is reported. This could eg. happen if no conversion fullfill constraint (eg. currently R10k to anything WRT subsampling 4:2:0). --- src/video_compress/libavcodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_compress/libavcodec.cpp b/src/video_compress/libavcodec.cpp index 87d0c3aa7..fce375396 100644 --- a/src/video_compress/libavcodec.cpp +++ b/src/video_compress/libavcodec.cpp @@ -1236,7 +1236,7 @@ static bool configure_with(struct state_video_compress_libav *s, struct video_de //get all AVPixelFormats we can convert to and pick the first auto fmts = get_available_pix_fmts(desc, codec, s->requested_subsampling, VIDEO_CODEC_NONE); s->sws_out_pixfmt = s->selected_pixfmt; - s->selected_pixfmt = fmts.front(); + s->selected_pixfmt = fmts.empty() ? AV_PIX_FMT_UYVY422 : fmts.front(); log_msg(LOG_LEVEL_NOTICE, MOD_NAME "Attempting to use swscale to convert from %s to %s.\n", av_get_pix_fmt_name(s->selected_pixfmt), av_get_pix_fmt_name(s->sws_out_pixfmt)); if(!find_decoder(desc, s->selected_pixfmt, &s->decoded_codec, &s->decoder)){ //Should not happen as get_available_pix_fmts should only