From 37ba866d523c28e9cc148b76e3d85779636fd994 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Sun, 10 Dec 2023 03:25:57 +1100 Subject: [PATCH] multiqueue: Ignore queue fullness for most events Use gst_data_queue_push_force() for most events so they are immediately enqueued. Only gap events and actual buffer data will now block when the queue is full. This fixes a problem with non-flushing seek handling where events following a segment-done event would block if they precede the SEGMENT event, since only SEGMENT events would clear the 'eos' state of the multiqueue queue. Part-of: --- .../gstreamer/plugins/elements/gstmultiqueue.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/subprojects/gstreamer/plugins/elements/gstmultiqueue.c b/subprojects/gstreamer/plugins/elements/gstmultiqueue.c index 9f204c9efe..c9a0afb5a8 100644 --- a/subprojects/gstreamer/plugins/elements/gstmultiqueue.c +++ b/subprojects/gstreamer/plugins/elements/gstmultiqueue.c @@ -2635,6 +2635,7 @@ gst_multi_queue_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) GstEventType type; GstEvent *sref = NULL; GstPad *srcpad; + gboolean is_timed_event = FALSE; sq = GST_MULTIQUEUE_PAD (pad)->sq; @@ -2719,6 +2720,7 @@ gst_multi_queue_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); } } + is_timed_event = TRUE; break; default: @@ -2742,8 +2744,13 @@ gst_multi_queue_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) "Enqueuing event %p of type %s with id %d", event, GST_EVENT_TYPE_NAME (event), curid); - if (!gst_data_queue_push (sq->queue, (GstDataQueueItem *) item)) - goto flushing; + if (is_timed_event) { + if (!gst_data_queue_push (sq->queue, (GstDataQueueItem *) item)) + goto flushing; + } else { + if (!gst_data_queue_push_force (sq->queue, (GstDataQueueItem *) item)) + goto flushing; + } /* mark EOS when we received one, we must do that after putting the * buffer in the queue because EOS marks the buffer as filled. */