+2006-08-14 Wim Taymans <wim@fluendo.com>
+
+ * 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 <wingo@pobox.com>
* configure.ac:
* 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.
* 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"
}
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;
}
}
}
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;
}
}
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);
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;
+ }
}