basesrc: remove 0.11 fixme
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 7 Jun 2012 08:34:46 +0000 (10:34 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 7 Jun 2012 13:32:27 +0000 (15:32 +0200)
We always require elements to have an unlock_stop vmethod.

libs/gst/base/gstbasesrc.c

index 9492c12..8a4fec6 100644 (file)
@@ -318,7 +318,7 @@ static gboolean gst_base_src_decide_allocation_default (GstBaseSrc * basesrc,
     GstQuery * query);
 
 static gboolean gst_base_src_set_flushing (GstBaseSrc * basesrc,
-    gboolean flushing, gboolean live_play, gboolean unlock, gboolean * playing);
+    gboolean flushing, gboolean live_play, gboolean * playing);
 
 static gboolean gst_base_src_start (GstBaseSrc * basesrc);
 static gboolean gst_base_src_stop (GstBaseSrc * basesrc);
@@ -1481,15 +1481,8 @@ not_ok:
  * when we reach the segment.stop we have to post a segment.done
  * instead of EOS when doing a segment seek.
  */
-/* FIXME (0.11), we have the unlock gboolean here because most current
- * implementations (fdsrc, -base/gst/tcp/, ...) unconditionally unlock, even when
- * the streaming thread isn't running, resulting in bogus unlocks later when it
- * starts. This is fixed by adding unlock_stop, but we should still avoid unlocking
- * unnecessarily for backwards compatibility. Ergo, the unlock variable stays
- * until 0.11
- */
 static gboolean
-gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
+gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event)
 {
   gboolean res = TRUE, tres;
   gdouble rate;
@@ -1548,7 +1541,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
     gst_pad_pause_task (src->srcpad);
 
   /* unblock streaming thread. */
-  gst_base_src_set_flushing (src, TRUE, FALSE, unlock, &playing);
+  gst_base_src_set_flushing (src, TRUE, FALSE, &playing);
 
   /* grab streaming lock, this should eventually be possible, either
    * because the task is paused, our streaming thread stopped
@@ -1563,7 +1556,7 @@ gst_base_src_perform_seek (GstBaseSrc * src, GstEvent * event, gboolean unlock)
     GST_DEBUG_OBJECT (src, "seek with seqnum %" G_GUINT32_FORMAT, seqnum);
   }
 
-  gst_base_src_set_flushing (src, FALSE, playing, unlock, NULL);
+  gst_base_src_set_flushing (src, FALSE, playing, NULL);
 
   /* If we configured the seeksegment above, don't overwrite it now. Otherwise
    * copy the current segment info into the temp segment that we can actually
@@ -1767,8 +1760,8 @@ gst_base_src_send_event (GstElement * element, GstEvent * event)
       if (started) {
         GST_DEBUG_OBJECT (src, "performing seek");
         /* when we are running in push mode, we can execute the
-         * seek right now, we need to unlock. */
-        result = gst_base_src_perform_seek (src, event, TRUE);
+         * seek right now. */
+        result = gst_base_src_perform_seek (src, event);
       } else {
         GstEvent **event_p;
 
@@ -1863,15 +1856,15 @@ gst_base_src_default_event (GstBaseSrc * src, GstEvent * event)
       if (!gst_base_src_seekable (src))
         goto not_seekable;
 
-      result = gst_base_src_perform_seek (src, event, TRUE);
+      result = gst_base_src_perform_seek (src, event);
       break;
     case GST_EVENT_FLUSH_START:
       /* cancel any blocking getrange, is normally called
        * when in pull mode. */
-      result = gst_base_src_set_flushing (src, TRUE, FALSE, TRUE, NULL);
+      result = gst_base_src_set_flushing (src, TRUE, FALSE, NULL);
       break;
     case GST_EVENT_FLUSH_STOP:
-      result = gst_base_src_set_flushing (src, FALSE, TRUE, TRUE, NULL);
+      result = gst_base_src_set_flushing (src, FALSE, TRUE, NULL);
       break;
     case GST_EVENT_QOS:
     {
@@ -3130,7 +3123,7 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret)
 
   /* stop flushing now but for live sources, still block in the LIVE lock when
    * we are not yet PLAYING */
-  gst_base_src_set_flushing (basesrc, FALSE, FALSE, FALSE, NULL);
+  gst_base_src_set_flushing (basesrc, FALSE, FALSE, NULL);
 
   gst_pad_mark_reconfigure (GST_BASE_SRC_PAD (basesrc));
 
@@ -3148,10 +3141,8 @@ gst_base_src_start_complete (GstBaseSrc * basesrc, GstFlowReturn ret)
     basesrc->pending_seek = NULL;
     GST_OBJECT_UNLOCK (basesrc);
 
-    /* no need to unlock anything, the task is certainly
-     * not running here. The perform seek code will start the task when
-     * finished. */
-    if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event, FALSE)))
+    /* The perform seek code will start the task when finished. */
+    if (G_UNLIKELY (!gst_base_src_perform_seek (basesrc, event)))
       goto seek_failed;
 
     if (event)
@@ -3177,7 +3168,7 @@ seek_failed:
   {
     GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
     GST_ERROR_OBJECT (basesrc, "Failed to perform initial seek");
-    gst_base_src_set_flushing (basesrc, TRUE, FALSE, TRUE, NULL);
+    gst_base_src_set_flushing (basesrc, TRUE, FALSE, NULL);
     if (event)
       gst_event_unref (event);
     ret = GST_FLOW_ERROR;
@@ -3186,7 +3177,7 @@ seek_failed:
 no_get_range:
   {
     GST_PAD_STREAM_UNLOCK (basesrc->srcpad);
-    gst_base_src_set_flushing (basesrc, TRUE, FALSE, TRUE, NULL);
+    gst_base_src_set_flushing (basesrc, TRUE, FALSE, NULL);
     GST_ERROR_OBJECT (basesrc, "Cannot operate in pull mode, stopping");
     ret = GST_FLOW_ERROR;
     goto error;
@@ -3248,7 +3239,7 @@ gst_base_src_stop (GstBaseSrc * basesrc)
   GST_DEBUG_OBJECT (basesrc, "stopping source");
 
   /* flush all */
-  gst_base_src_set_flushing (basesrc, TRUE, FALSE, TRUE, NULL);
+  gst_base_src_set_flushing (basesrc, TRUE, FALSE, NULL);
   /* stop the task */
   gst_pad_stop_task (basesrc->srcpad);
 
@@ -3282,13 +3273,13 @@ was_stopped:
  */
 static gboolean
 gst_base_src_set_flushing (GstBaseSrc * basesrc,
-    gboolean flushing, gboolean live_play, gboolean unlock, gboolean * playing)
+    gboolean flushing, gboolean live_play, gboolean * playing)
 {
   GstBaseSrcClass *bclass;
 
   bclass = GST_BASE_SRC_GET_CLASS (basesrc);
 
-  if (flushing && unlock) {
+  if (flushing) {
     gst_base_src_activate_pool (basesrc, FALSE);
     /* unlock any subclasses, we need to do this before grabbing the
      * LIVE_LOCK since we hold this lock before going into ::create. We pass an
@@ -3323,18 +3314,16 @@ gst_base_src_set_flushing (GstBaseSrc * basesrc,
 
     gst_base_src_activate_pool (basesrc, TRUE);
 
-    /* When unlocking drop all delayed events */
-    if (unlock) {
-      GST_OBJECT_LOCK (basesrc);
-      if (basesrc->priv->pending_events) {
-        g_list_foreach (basesrc->priv->pending_events, (GFunc) gst_event_unref,
-            NULL);
-        g_list_free (basesrc->priv->pending_events);
-        basesrc->priv->pending_events = NULL;
-        g_atomic_int_set (&basesrc->priv->have_events, FALSE);
-      }
-      GST_OBJECT_UNLOCK (basesrc);
+    /* Drop all delayed events */
+    GST_OBJECT_LOCK (basesrc);
+    if (basesrc->priv->pending_events) {
+      g_list_foreach (basesrc->priv->pending_events, (GFunc) gst_event_unref,
+          NULL);
+      g_list_free (basesrc->priv->pending_events);
+      basesrc->priv->pending_events = NULL;
+      g_atomic_int_set (&basesrc->priv->have_events, FALSE);
     }
+    GST_OBJECT_UNLOCK (basesrc);
   }
   GST_LIVE_SIGNAL (basesrc);
   GST_LIVE_UNLOCK (basesrc);