From 5a83745316c7b2b3d4a1cea27bf3580252ef7708 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 24 Feb 2023 23:12:22 +0100 Subject: vd_lavc: sort hwdecs without hwdevices last for autoprobing For hwdecs without devices we can't get instant feedback during probing whether the hwdec can possibly work or not, so we definitely want to try them last. Independently this would also have solved the issue addressed by the previous commit. --- video/decode/vd_lavc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'video') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 6efe5deb06..020ae6a991 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -267,6 +267,9 @@ static int hwdec_compare(const void *p1, const void *p2) // Order by autoprobe preference order. if (h1->auto_pos != h2->auto_pos) return h1->auto_pos > h2->auto_pos ? 1 : -1; + // Put hwdecs without hw_device_ctx last + if ((!!h1->lavc_device) != (!!h2->lavc_device)) + return h1->lavc_device ? -1 : 1; // Fallback sort order to make sorting stable. return h1->rank > h2->rank ? 1 :-1; } -- cgit v1.2.3