From: <fe...@ke...> - 2009-09-19 16:21:39
|
Module: gst-openmax Branch: master Commit: 6888b2bd80eff39e23ccc0aa36c72f1220232d47 URL: http://cgit.freedesktop.org/gstreamer/gst-openmax/commit/?id=6888b2bd80eff39e23ccc0aa36c72f1220232d47 Author: Mark Nauwelaerts <mar...@co...> Date: Tue May 19 16:26:00 2009 +0200 base_filter: fix race condition when shutting down .. between starting streaming thread and mainloop. Signed-off-by: Mark Nauwelaerts <mar...@co...> Signed-off-by: Felipe Contreras <fel...@gm...> --- omx/gstomx_base_filter.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c index e547013..e6bcbf7 100644 --- a/omx/gstomx_base_filter.c +++ b/omx/gstomx_base_filter.c @@ -300,6 +300,10 @@ output_loop (gpointer data) GST_LOG_OBJECT (self, "begin"); + /* do not bother if we have been setup to bail out */ + if ((ret = g_atomic_int_get (&self->last_pad_push_return)) != GST_FLOW_OK) + goto leave; + if (!self->ready) { g_error ("not ready"); @@ -823,7 +827,8 @@ activate_push (GstPad *pad, if (active) { GST_DEBUG_OBJECT (self, "activate"); - self->last_pad_push_return = GST_FLOW_OK; + /* task may carry on */ + g_atomic_int_set (&self->last_pad_push_return, GST_FLOW_OK); /* we do not start the task yet if the pad is not connected */ if (gst_pad_is_linked (pad)) @@ -842,6 +847,9 @@ activate_push (GstPad *pad, { GST_DEBUG_OBJECT (self, "deactivate"); + /* persuade task to bail out */ + g_atomic_int_set (&self->last_pad_push_return, GST_FLOW_WRONG_STATE); + if (self->ready) { /** @todo disable this until we properly reinitialize the buffers. */ |