queue2: Fix modes in scheduling query handling
authorJonathan Matthew <jonathan@d14n.org>
Tue, 3 Nov 2020 12:39:54 +0000 (22:39 +1000)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 4 Nov 2020 09:05:18 +0000 (09:05 +0000)
Create a new query to send upstream and copy the flags across from it,
rather than reusing the same query, as this allows us to prevent use
of pull mode when we don't have a download file.

Fixes: #629
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/693>

plugins/elements/gstqueue2.c

index 20cca1c..cb230b3 100644 (file)
@@ -3490,11 +3490,16 @@ gst_queue2_handle_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
     {
       gboolean pull_mode;
       GstSchedulingFlags flags = 0;
+      GstQuery *upstream;
 
-      if (!gst_pad_peer_query (queue->sinkpad, query))
+      upstream = gst_query_new_scheduling ();
+      if (!gst_pad_peer_query (queue->sinkpad, upstream)) {
+        gst_query_unref (upstream);
         goto peer_failed;
+      }
 
-      gst_query_parse_scheduling (query, &flags, NULL, NULL, NULL);
+      gst_query_parse_scheduling (upstream, &flags, NULL, NULL, NULL);
+      gst_query_unref (upstream);
 
       /* we can operate in pull mode when we are using a tempfile */
       pull_mode = !QUEUE_IS_USING_QUEUE (queue);