From 0eee03d6888d0e5df19a31be86bb73190135e256 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 29 Sep 2023 14:46:35 +0200 Subject: [PATCH] videoaggregator: Avoid creating caps that are not in the template By using the gst_caps_set_simple() to set the format on all structures, the compositor may create invalid combinations as the caps may contain passthrough caps. Avoid this issue by intersecting the resul with its original. Part-of: --- .../gst-libs/gst/video/gstvideoaggregator.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideoaggregator.c b/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideoaggregator.c index ffbf69d401..80acedf35c 100644 --- a/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideoaggregator.c +++ b/subprojects/gst-plugins-base/gst-libs/gst/video/gstvideoaggregator.c @@ -1254,6 +1254,15 @@ gst_video_aggregator_default_update_caps (GstVideoAggregator * vagg, best_format_caps = gst_caps_copy (caps); gst_caps_set_simple (best_format_caps, "format", G_TYPE_STRING, gst_video_format_to_string (best_format), NULL); + /* + * set_simple() will likely create some invalid combination, as it may as an + * example set format to NV12 with memory:DMABuf caps feature where DMA_DRM + * format might be the only supported formats. Simply intersect with the + * original to fix this. + */ + ret = gst_caps_intersect (best_format_caps, caps); + gst_caps_replace (&best_format_caps, ret); + gst_clear_caps (&ret); if (chroma_site != NULL) gst_caps_set_simple (best_format_caps, "chroma-site", G_TYPE_STRING,