queue: Remove useless checks from e406f7
authorEdward Hervey <bilboed@bilboed.com>
Tue, 19 Oct 2010 13:53:26 +0000 (15:53 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Thu, 2 Dec 2010 18:04:56 +0000 (19:04 +0100)
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

index 6989faf..a641dfe 100644 (file)
@@ -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;
     }
   }