From 350a7197e777393929a1ebdef3401288c9917fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 6 May 2020 11:42:05 +0300 Subject: [PATCH] discoverer: Try to get negotiated caps first on pad-added and only then fall back to a caps query The negotiated caps will be more accurate and are fixed caps in any case. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/498 Part-of: --- gst-libs/gst/pbutils/gstdiscoverer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c index 2fb97cc9ab..7dfd7eeefb 100644 --- a/gst-libs/gst/pbutils/gstdiscoverer.c +++ b/gst-libs/gst/pbutils/gstdiscoverer.c @@ -701,7 +701,12 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad, g_object_set (ps->sink, "silent", TRUE, NULL); g_object_set (ps->queue, "max-size-buffers", 1, "silent", TRUE, NULL); - caps = gst_pad_query_caps (pad, NULL); + caps = gst_pad_get_current_caps (pad); + if (!caps) { + GST_WARNING ("Couldn't get negotiated caps from %s:%s", + GST_DEBUG_PAD_NAME (pad)); + caps = gst_pad_query_caps (pad, NULL); + } sinkpad = gst_element_get_static_pad (ps->queue, "sink"); if (sinkpad == NULL)