From 12d2d016634fa9fa83a6de6b341bdfc8d71f7fff Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 14 Feb 2011 17:31:25 +0100 Subject: [PATCH] pad: Check sinkpad for flushing 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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gst/gstpad.c b/gst/gstpad.c index 6b63db32..4276471 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -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; + } } /** -- 2.7.4