2008-11-13 Wim Taymans <wim.taymans@collabora.co.uk>
+ * gst/gstbuffer.c: (gst_buffer_finalize):
+ Avoid costly typechecking for trivially correct pointers.
+
+ * gst/gstpoll.c: (gst_poll_wait):
+ Add some G_LIKELY here and there.
+
+ * libs/gst/base/gstadapter.c: (gst_adapter_push):
+ Add some debug info.
+
+2008-11-13 Wim Taymans <wim.taymans@collabora.co.uk>
+
* docs/random/wtay/poll-timeout:
Small tweaks.
gst_caps_replace (&GST_BUFFER_CAPS (buffer), NULL);
- GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (buffer));
+ parent_class->finalize (GST_MINI_OBJECT_CAST (buffer));
}
/**
g_mutex_lock (set->lock);
/* we cannot wait from multiple threads */
- if (set->waiting)
+ if (G_UNLIKELY (set->waiting))
goto already_waiting;
/* flushing, exit immediatly */
- if (set->flushing)
+ if (G_UNLIKELY (set->flushing))
goto flushing;
set->waiting = TRUE;
g_mutex_lock (set->lock);
+ /* FIXME, can we only do this check when (res > 0)? */
gst_poll_check_ctrl_commands (set, res, &restarting);
/* update the controllable state if needed */
set->controllable = set->new_controllable;
- if (set->flushing) {
+ if (G_UNLIKELY (set->flushing)) {
/* we got woken up and we are flushing, we need to stop */
errno = EBUSY;
res = -1;
break;
}
- } while (restarting);
+ } while (G_UNLIKELY (restarting));
set->waiting = FALSE;
void
gst_adapter_push (GstAdapter * adapter, GstBuffer * buf)
{
+ guint size;
+
g_return_if_fail (GST_IS_ADAPTER (adapter));
g_return_if_fail (GST_IS_BUFFER (buf));
- adapter->size += GST_BUFFER_SIZE (buf);
+ size = GST_BUFFER_SIZE (buf);
+
+ adapter->size += size;
/* Note: merging buffers at this point is premature. */
if (G_UNLIKELY (adapter->buflist == NULL)) {
+ GST_LOG_OBJECT (adapter, "pushing first %u bytes", size);
adapter->buflist = adapter->buflist_end = g_slist_append (NULL, buf);
} else {
/* Otherwise append to the end, and advance our end pointer */
+ GST_LOG_OBJECT (adapter, "pushing %u bytes at end, size now %u", size,
+ adapter->size);
adapter->buflist_end = g_slist_append (adapter->buflist_end, buf);
adapter->buflist_end = g_slist_next (adapter->buflist_end);
}