From 0c2086a4750d077eb3b3f40cd039b33d904c966f Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 19 Oct 2010 15:53:26 +0200 Subject: [PATCH] queue: Remove useless checks from e406f7 srcresult was being rechecked in places it couldn't have changed. queue level was being rechecked in places it couldn't have changed. https://bugzilla.gnome.org/show_bug.cgi?id=632780 --- plugins/elements/gstqueue.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 6989faf56f..a641dfeb56 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -963,15 +963,11 @@ gst_queue_chain (GstPad * pad, GstBuffer * buffer) GST_QUEUE_MUTEX_UNLOCK (queue); g_signal_emit (queue, gst_queue_signals[SIGNAL_OVERRUN], 0); GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); - } else { - if (queue->srcresult != GST_FLOW_OK) - goto out_flushing; + /* we recheck, the signal could have changed the thresholds */ + if (!gst_queue_is_filled (queue)) + break; } - /* we recheck, the signal could have changed the thresholds */ - if (!gst_queue_is_filled (queue)) - break; - /* how are we going to make space for this buffer? */ switch (queue->leaky) { case GST_QUEUE_LEAK_UPSTREAM: @@ -1005,9 +1001,6 @@ gst_queue_chain (GstPad * pad, GstBuffer * buffer) GST_QUEUE_MUTEX_UNLOCK (queue); g_signal_emit (queue, gst_queue_signals[SIGNAL_RUNNING], 0); GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); - } else { - if (queue->srcresult != GST_FLOW_OK) - goto out_flushing; } break; } @@ -1228,15 +1221,11 @@ gst_queue_loop (GstPad * pad) GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); while (gst_queue_is_empty (queue)) { + GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is empty"); if (!queue->silent) { GST_QUEUE_MUTEX_UNLOCK (queue); g_signal_emit (queue, gst_queue_signals[SIGNAL_UNDERRUN], 0); - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is empty"); GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); - } else { - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is empty"); - if (queue->srcresult != GST_FLOW_OK) - goto out_flushing; } /* we recheck, the signal could have changed the thresholds */ @@ -1244,16 +1233,12 @@ gst_queue_loop (GstPad * pad) GST_QUEUE_WAIT_ADD_CHECK (queue, out_flushing); } + GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is not empty"); if (!queue->silent) { GST_QUEUE_MUTEX_UNLOCK (queue); g_signal_emit (queue, gst_queue_signals[SIGNAL_RUNNING], 0); g_signal_emit (queue, gst_queue_signals[SIGNAL_PUSHING], 0); - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is not empty"); GST_QUEUE_MUTEX_LOCK_CHECK (queue, out_flushing); - } else { - GST_CAT_DEBUG_OBJECT (queue_dataflow, queue, "queue is not empty"); - if (queue->srcresult != GST_FLOW_OK) - goto out_flushing; } }