gst/gstbuffer.c: Small docs update.

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.
This commit is contained in:
Wim Taymans 2005-12-07 15:16:43 +00:00
parent 4e8cd3c843
commit d16ce65df7
5 changed files with 31 additions and 14 deletions

View file

@ -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> 2005-12-07 Michael Smith <msmith@fluendo.com>
* gst/parse/grammar.y: * gst/parse/grammar.y:

View 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 * Gets the media type of the buffer. This can be NULL if there
* is no media type attached to this buffer. * 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. * Returns NULL if there were no caps on this buffer.
*/ */
/* FIXME can we make this threadsafe without a lock on the buffer? /* FIXME can we make this threadsafe without a lock on the buffer?

View file

@ -872,8 +872,10 @@ gst_caps_is_equal (const GstCaps * caps1, const GstCaps * caps2)
if (caps1 == caps2) if (caps1 == caps2)
return TRUE; return TRUE;
g_return_val_if_fail (caps1 != NULL, FALSE); /* one of them NULL => they are different (can't be both NULL because
g_return_val_if_fail (caps2 != NULL, FALSE); * we checked that above) */
if (caps1 == NULL || caps2 == NULL)
return FALSE;
if (gst_caps_is_fixed (caps1) && gst_caps_is_fixed (caps2)) if (gst_caps_is_fixed (caps1) && gst_caps_is_fixed (caps2))
return gst_caps_is_equal_fixed (caps1, caps2); return gst_caps_is_equal_fixed (caps1, caps2);

View file

@ -312,18 +312,16 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
{ {
GstMiniObject *olddata_val; GstMiniObject *olddata_val;
if (newdata) { if (newdata)
gst_mini_object_ref (newdata); gst_mini_object_ref (newdata);
}
do { do {
olddata_val = *olddata; olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
} while (!g_atomic_pointer_compare_and_exchange ((gpointer *) olddata, } while (!g_atomic_pointer_compare_and_exchange ((gpointer *) olddata,
olddata_val, newdata)); olddata_val, newdata));
if (olddata_val) { if (olddata_val)
gst_mini_object_unref (olddata_val); gst_mini_object_unref (olddata_val);
}
} }
static void static void

View file

@ -1351,7 +1351,7 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
/* we can answer time format */ /* we can answer time format */
GST_OBJECT_LOCK (basesink); GST_OBJECT_LOCK (basesink);
if ((clock = GST_ELEMENT_CLOCK (basesink))) { if ((clock = GST_ELEMENT_CLOCK (basesink))) {
GstClockTime now; GstClockTime now, base;
gint64 time; gint64 time;
gst_object_ref (clock); gst_object_ref (clock);
@ -1365,13 +1365,15 @@ gst_base_sink_get_position (GstBaseSink * basesink, GstFormat format,
else else
time = 0; time = 0;
*cur = now - GST_ELEMENT_CAST (basesink)->base_time - base = GST_ELEMENT_CAST (basesink)->base_time;
basesink->segment.accum + time; *cur = now - base - basesink->segment.accum + time;
GST_DEBUG_OBJECT (basesink, GST_DEBUG_OBJECT (basesink,
"now %" GST_TIME_FORMAT " + segment_time %" GST_TIME_FORMAT " = %" "now %" GST_TIME_FORMAT " - base %" GST_TIME_FORMAT " - accum %"
GST_TIME_FORMAT, GST_TIME_ARGS (now), GST_TIME_FORMAT " + time %" GST_TIME_FORMAT " = %" GST_TIME_FORMAT,
GST_TIME_ARGS (time), GST_TIME_ARGS (*cur)); 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); gst_object_unref (clock);