pad: Check sinkpad for flushing
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 14 Feb 2011 16:31:25 +0000 (17:31 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 14 Feb 2011 16:31:25 +0000 (17:31 +0100)
Check the sinkpad for the flushing state before calling the chainfunction on the
pad. We do this by checking the cache (which is also cleared on the srcpad when
the sink is set to flushing).

Fixes #641928

gst/gstpad.c

index 6b63db3..4276471 100644 (file)
@@ -4658,6 +4658,8 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
   peer = cache->peer;
 
   GST_PAD_STREAM_LOCK (peer);
+  if (G_UNLIKELY (g_atomic_pointer_get (cache_ptr) == PAD_CACHE_INVALID))
+    goto invalid;
 
   GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "calling chainfunction &%s",
       GST_DEBUG_FUNCPTR_NAME (GST_PAD_CHAINFUNC (peer)));
@@ -4697,6 +4699,12 @@ slow_path:
     }
     return ret;
   }
+invalid:
+  {
+    pad_free_cache (cache);
+    GST_PAD_STREAM_UNLOCK (peer);
+    goto slow_path;
+  }
 }
 
 /**
@@ -4770,6 +4778,8 @@ gst_pad_push_list (GstPad * pad, GstBufferList * list)
   peer = cache->peer;
 
   GST_PAD_STREAM_LOCK (peer);
+  if (G_UNLIKELY (g_atomic_pointer_get (cache_ptr) == PAD_CACHE_INVALID))
+    goto invalid;
 
   ret = GST_PAD_CHAINLISTFUNC (peer) (peer, list);
 
@@ -4801,6 +4811,12 @@ slow_path:
     }
     return ret;
   }
+invalid:
+  {
+    pad_free_cache (cache);
+    GST_PAD_STREAM_UNLOCK (peer);
+    goto slow_path;
+  }
 }
 
 /**