gst/gstbuffer.c: Small docs update.
authorWim Taymans <wim.taymans@gmail.com>
Wed, 7 Dec 2005 15:16:43 +0000 (15:16 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 7 Dec 2005 15:16:43 +0000 (15:16 +0000)
Original commit message from CVS:
* gst/gstbuffer.c:
Small docs update.

* gst/gstcaps.c: (gst_caps_is_equal):
Don't assert on NULL <--> X. Fixes #323260

* gst/gstminiobject.c: (gst_mini_object_replace):
If we're doing atomic operations, we might just as well use
the proper way to get an atomic pointer.

* libs/gst/base/gstbasesink.c: (gst_base_sink_get_position):
Clean up debugging.

ChangeLog
gst/gstbuffer.c
gst/gstcaps.c
gst/gstminiobject.c
libs/gst/base/gstbasesink.c

index fdc8ce8..bd9c27a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2005-12-07  Wim Taymans  <wim@fluendo.com>
+
+       * gst/gstbuffer.c:
+       Small docs update.
+
+       * gst/gstcaps.c: (gst_caps_is_equal):
+       Don't assert on NULL <--> X. Fixes #323260
+
+       * gst/gstminiobject.c: (gst_mini_object_replace):
+       If we're doing atomic operations, we might just as well use
+       the proper way to get an atomic pointer.
+
+       * libs/gst/base/gstbasesink.c: (gst_base_sink_get_position):
+       Clean up debugging.
+
 2005-12-07  Michael Smith  <msmith@fluendo.com>
 
        * gst/parse/grammar.y:
index b4cf5ee..f095895 100644 (file)
@@ -291,7 +291,7 @@ gst_buffer_new_and_alloc (guint size)
  * Gets the media type of the buffer. This can be NULL if there
  * is no media type attached to this buffer.
  *
- * Returns: a reference to the #GstCaps.
+ * Returns: a reference to the #GstCaps. unref after usage.
  * Returns NULL if there were no caps on this buffer.
  */
 /* FIXME can we make this threadsafe without a lock on the buffer?
index 5300e58..c58b659 100644 (file)
@@ -872,8 +872,10 @@ gst_caps_is_equal (const GstCaps * caps1, const GstCaps * caps2)
   if (caps1 == caps2)
     return TRUE;
 
-  g_return_val_if_fail (caps1 != NULL, FALSE);
-  g_return_val_if_fail (caps2 != NULL, FALSE);
+  /* one of them NULL => they are different (can't be both NULL because
+   * we checked that above) */
+  if (caps1 == NULL || caps2 == NULL)
+    return FALSE;
 
   if (gst_caps_is_fixed (caps1) && gst_caps_is_fixed (caps2))
     return gst_caps_is_equal_fixed (caps1, caps2);
index eb94e71..3d6c72c 100644 (file)
@@ -312,18 +312,16 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
 {
   GstMiniObject *olddata_val;
 
-  if (newdata) {
+  if (newdata)
     gst_mini_object_ref (newdata);
-  }
 
   do {
-    olddata_val = *olddata;
+    olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
   } while (!g_atomic_pointer_compare_and_exchange ((gpointer *) olddata,
           olddata_val, newdata));
 
-  if (olddata_val) {
+  if (olddata_val)
     gst_mini_object_unref (olddata_val);
-  }
 }
 
 static void
index 1ef74d5..d93307c 100644 (file)
@@ -1351,7 +1351,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
       /* we can answer time format */
       GST_OBJECT_LOCK (basesink);
       if ((clock = GST_ELEMENT_CLOCK (basesink))) {
-        GstClockTime now;
+        GstClockTime now, base;
         gint64 time;
 
         gst_object_ref (clock);
@@ -1365,13 +1365,15 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
         else
           time = 0;
 
-        *cur = now - GST_ELEMENT_CAST (basesink)->base_time -
-            basesink->segment.accum + time;
+        base = GST_ELEMENT_CAST (basesink)->base_time;
+        *cur = now - base - basesink->segment.accum + time;
 
         GST_DEBUG_OBJECT (basesink,
-            "now %" GST_TIME_FORMAT " + segment_time %" GST_TIME_FORMAT " = %"
-            GST_TIME_FORMAT, GST_TIME_ARGS (now),
-            GST_TIME_ARGS (time), GST_TIME_ARGS (*cur));
+            "now %" GST_TIME_FORMAT " - base %" GST_TIME_FORMAT " - accum %"
+            GST_TIME_FORMAT " + time %" GST_TIME_FORMAT " = %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (now), GST_TIME_ARGS (base),
+            GST_TIME_ARGS (basesink->segment.accum), GST_TIME_ARGS (time),
+            GST_TIME_ARGS (*cur));
 
         gst_object_unref (clock);