matroskademux: Handle element's duration query.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 14 Nov 2022 11:51:19 +0000 (12:51 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 14 Nov 2022 15:10:44 +0000 (15:10 +0000)
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>

subprojects/gst-plugins-good/gst/matroska/matroska-demux.c

index 773a306..38e4e4d 100644 (file)
@@ -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);