From 3254e4d752ea754270d1b896c0504324ec6bd2a9 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 14 Aug 2006 07:35:09 +0000 Subject: [PATCH] gst/: Small doc updates. Original commit message from CVS: * gst/gstbuffer.c: * gst/gsttask.c: (gst_task_join): Small doc updates. * gst/gstpad.c: (gst_pad_activate_pull), (gst_pad_activate_push), (gst_pad_stop_task): When pad (de)activation failed for some reason, restore the old activation mode and set the pad to flushing instead of assuming the pad is deactivated. If the _task_join() failed, reinstall the task on the pad so that it can be stopped later and return an error. --- ChangeLog | 14 ++++++++++++++ gst/gstbuffer.c | 6 +++++- gst/gstpad.c | 29 ++++++++++++++++++++++++----- gst/gsttask.c | 2 ++ win32/common/config.h | 2 +- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 321b22c..8ca8b65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-08-14 Wim Taymans + + * gst/gstbuffer.c: + * gst/gsttask.c: (gst_task_join): + Small doc updates. + + * gst/gstpad.c: (gst_pad_activate_pull), (gst_pad_activate_push), + (gst_pad_stop_task): + When pad (de)activation failed for some reason, restore the old + activation mode and set the pad to flushing instead of assuming the + pad is deactivated. + If the _task_join() failed, reinstall the task on the pad so that it can + be stopped later and return an error. + 2006-08-11 Andy Wingo * configure.ac: diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 39a0e89..ff8c368 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -53,6 +53,10 @@ * Alternatively, use gst_buffer_new_and_alloc() * to create a buffer with preallocated data of a given size. * + * The data pointed to by the buffer can be retrieved with the GST_BUFFER_DATA() + * macro. The size of the data can be found with GST_BUFFER_SIZE(). For buffers + * of size 0, the data pointer is undefined (usually NULL) and should never be used. + * * If an element knows what pad you will push the buffer out on, it should use * gst_pad_alloc_buffer() instead to create a buffer. This allows downstream * elements to provide special buffers to write in, like hardware buffers. @@ -107,7 +111,7 @@ * the refcount drops to 0, any data pointed to by GST_BUFFER_MALLOCDATA() will * also be freed. * - * Last reviewed on November 23th, 2005 (0.9.5) + * Last reviewed on August 11th, 2006 (0.10.10) */ #include "gst_private.h" diff --git a/gst/gstpad.c b/gst/gstpad.c index 7fc2502..ee9f45a 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -783,10 +783,12 @@ peer_failed: } failure: { + GST_OBJECT_LOCK (pad); GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in pull mode", active ? "activate" : "deactivate"); - pre_activate (pad, GST_ACTIVATE_NONE); - post_activate (pad, GST_ACTIVATE_NONE); + GST_PAD_SET_FLUSHING (pad); + GST_PAD_ACTIVATE_MODE (pad) = old; + GST_OBJECT_UNLOCK (pad); return FALSE; } } @@ -879,10 +881,12 @@ deactivate_failed: } failure: { + GST_OBJECT_LOCK (pad); GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in push mode", active ? "activate" : "deactivate"); - pre_activate (pad, GST_ACTIVATE_NONE); - post_activate (pad, GST_ACTIVATE_NONE); + GST_PAD_SET_FLUSHING (pad); + GST_PAD_ACTIVATE_MODE (pad) = old; + GST_OBJECT_UNLOCK (pad); return FALSE; } } @@ -4180,7 +4184,8 @@ gst_pad_stop_task (GstPad * pad) GST_PAD_STREAM_LOCK (pad); GST_PAD_STREAM_UNLOCK (pad); - gst_task_join (task); + if (!gst_task_join (task)) + goto join_failed; gst_object_unref (task); @@ -4193,6 +4198,20 @@ no_task: GST_PAD_STREAM_LOCK (pad); GST_PAD_STREAM_UNLOCK (pad); + /* this is not an error */ return TRUE; } +join_failed: + { + /* this is bad, possibly the application tried to join the task from + * the task's thread. We install the task again so that it will be stopped + * again from the right thread next time hopefully. */ + GST_OBJECT_LOCK (pad); + /* we can only install this task if there was no other task */ + if (GST_PAD_TASK (pad) == NULL) + GST_PAD_TASK (pad) = task; + GST_OBJECT_UNLOCK (pad); + + return FALSE; + } } diff --git a/gst/gsttask.c b/gst/gsttask.c index d61829b..8e49738 100644 --- a/gst/gsttask.c +++ b/gst/gsttask.c @@ -522,6 +522,8 @@ gst_task_join (GstTask * task) GST_DEBUG_OBJECT (task, "Joining task %p, thread %p", task, tself); + /* we don't use a real thread join here because we are using + * threadpools */ GST_OBJECT_LOCK (task); if (tself == task->abidata.ABI.thread) goto joining_self; diff --git a/win32/common/config.h b/win32/common/config.h index 47ee17d..f409e89 100644 --- a/win32/common/config.h +++ b/win32/common/config.h @@ -175,7 +175,7 @@ #define HAVE_WIN32 1 /* Define host CPU */ -#define HOST_CPU "x86_64" +#define HOST_CPU "mos6502" /* library dir */ #ifdef _DEBUG -- 2.7.4