gst/: Small doc updates.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 14 Aug 2006 07:35:09 +0000 (07:35 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 14 Aug 2006 07:35:09 +0000 (07:35 +0000)
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
gst/gstbuffer.c
gst/gstpad.c
gst/gsttask.c
win32/common/config.h

index 321b22c..8ca8b65 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+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:
index 39a0e89..ff8c368 100644 (file)
  * 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"
 
index 7fc2502..ee9f45a 100644 (file)
@@ -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;
+  }
 }
index d61829b..8e49738 100644 (file)
@@ -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;
index 47ee17d..f409e89 100644 (file)
 #define HAVE_WIN32 1
 
 /* Define host CPU */
-#define HOST_CPU "x86_64"
+#define HOST_CPU "mos6502"
 
 /* library dir */
 #ifdef _DEBUG