From 64cb38685b2c93393fb7ba08e4810c7ed7d65841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Mon, 14 Nov 2022 12:51:19 +0100 Subject: [PATCH] matroskademux: Handle element's duration query. This is small regression from commit f7abd81a. When calling `gst_element_query()` no pad is associated with that query, but the current code always forwards the query to the associated pad, which is NULL in previous case. This patch checks for the pad before forwarding the query. Part-of: --- subprojects/gst-plugins-good/gst/matroska/matroska-demux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c index 773a306343..38e4e4d8ee 100644 --- a/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c +++ b/subprojects/gst-plugins-good/gst/matroska/matroska-demux.c @@ -1839,9 +1839,10 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad, gst_query_parse_duration (query, &format, NULL); - res = TRUE; if (format == GST_FORMAT_TIME) { - res = gst_pad_query_default (pad, GST_OBJECT_CAST (demux), query); + res = FALSE; + if (pad) + res = gst_pad_query_default (pad, GST_OBJECT_CAST (demux), query); if (!res) { GST_OBJECT_LOCK (demux); gst_query_set_duration (query, GST_FORMAT_TIME, @@ -1852,6 +1853,8 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad, } } else if (format == GST_FORMAT_DEFAULT && context && context->default_duration) { + res = TRUE; + GST_OBJECT_LOCK (demux); gst_query_set_duration (query, GST_FORMAT_DEFAULT, demux->common.segment.duration / context->default_duration);