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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3404>
This commit is contained in:
Víctor Manuel Jáquez Leal 2022-11-14 12:51:19 +01:00 committed by GStreamer Marge Bot
parent 452890093d
commit 64cb38685b

View file

@ -1839,8 +1839,9 @@ gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad,
gst_query_parse_duration (query, &format, NULL);
res = TRUE;
if (format == GST_FORMAT_TIME) {
res = FALSE;
if (pad)
res = gst_pad_query_default (pad, GST_OBJECT_CAST (demux), query);
if (!res) {
GST_OBJECT_LOCK (demux);
@ -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);