From b981ec6e098421d5a480100213030a70341de04f Mon Sep 17 00:00:00 2001 From: Jason Zhao Date: Tue, 19 Aug 2008 08:52:05 +0000 Subject: [PATCH] libs/gst/base/gstbasesink.c: When the subclass event handler releases the PREROLL_LOCK, we could be in the flushing s... Original commit message from CVS: Based on patch by: Jason Zhao * libs/gst/base/gstbasesink.c: (gst_base_sink_render_object): When the subclass event handler releases the PREROLL_LOCK, we could be in the flushing state and we have to ignore the event. Fixes #548394. --- ChangeLog | 8 ++++++++ libs/gst/base/gstbasesink.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/ChangeLog b/ChangeLog index d6322f6fe6..9cd58c3cbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-08-19 Wim Taymans + + Based on patch by: Jason Zhao + + * libs/gst/base/gstbasesink.c: (gst_base_sink_render_object): + When the subclass event handler releases the PREROLL_LOCK, we could be + in the flushing state and we have to ignore the event. Fixes #548394. + 2008-08-18 Tim-Philipp Müller * tools/gst-launch.1.in: diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index adf814c2da..dfcc6ce0da 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -2108,6 +2108,9 @@ no_timestamp: } } +/* called before and after calling the render vmethod. It keeps track of how + * much time was spent in the render method and is used to check if we are + * flooded */ static void gst_base_sink_do_render_stats (GstBaseSink * basesink, gboolean start) { @@ -2205,6 +2208,12 @@ gst_base_sink_render_object (GstBaseSink * basesink, GstPad * pad, if (bclass->event) event_res = bclass->event (basesink, event); + /* when we get here we could be flushing again when the event handler calls + * _wait_eos() or releases the preroll lock in any other way. + * We have to ignore this object in that case. */ + if (G_UNLIKELY (basesink->flushing)) + goto flushing; + if (G_LIKELY (event_res)) { switch (type) { case GST_EVENT_EOS: @@ -2251,6 +2260,12 @@ dropped: GST_DEBUG_OBJECT (basesink, "buffer late, dropping"); goto done; } +flushing: + { + GST_DEBUG_OBJECT (basesink, "we are flushing, ignore object"); + gst_mini_object_unref (obj); + return GST_FLOW_WRONG_STATE; + } } /* with STREAM_LOCK, PREROLL_LOCK