mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
gst/gstbuffer.c: Avoid costly typechecking for trivially correct pointers.
Original commit message from CVS: * 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.
This commit is contained in:
parent
2488c97ebd
commit
3cc67ebab7
4 changed files with 25 additions and 6 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
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:
|
||||
|
|
|
@ -191,7 +191,7 @@ gst_buffer_finalize (GstBuffer * buffer)
|
|||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1038,11 +1038,11 @@ gst_poll_wait (GstPoll * set, GstClockTime timeout)
|
|||
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;
|
||||
|
@ -1208,18 +1208,19 @@ gst_poll_wait (GstPoll * set, GstClockTime timeout)
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -197,16 +197,23 @@ gst_adapter_clear (GstAdapter * adapter)
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue