mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
bufferlist: use faster gst_buffer_list_get()
Use the faster gst_buffer_list_get() to get the first buffer of a list.
This commit is contained in:
parent
939f6045b1
commit
92b0f32d74
2 changed files with 7 additions and 34 deletions
14
gst/gstpad.c
14
gst/gstpad.c
|
@ -3987,18 +3987,12 @@ gst_pad_data_get_caps (gboolean is_buffer, void *data)
|
|||
if (G_LIKELY (is_buffer)) {
|
||||
caps = GST_BUFFER_CAPS (data);
|
||||
} else {
|
||||
GstBufferListIterator *it;
|
||||
GstBuffer *buf;
|
||||
|
||||
caps = NULL;
|
||||
it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (data));
|
||||
if (gst_buffer_list_iterator_next_group (it)) {
|
||||
buf = gst_buffer_list_iterator_next (it);
|
||||
if (buf != NULL) {
|
||||
caps = GST_BUFFER_CAPS (buf);
|
||||
}
|
||||
}
|
||||
gst_buffer_list_iterator_free (it);
|
||||
if ((buf = gst_buffer_list_get (GST_BUFFER_LIST_CAST (data), 0, 0)))
|
||||
caps = GST_BUFFER_CAPS (buf);
|
||||
else
|
||||
caps = NULL;
|
||||
}
|
||||
return caps;
|
||||
}
|
||||
|
|
|
@ -2660,14 +2660,7 @@ gst_base_sink_render_object (GstBaseSink * basesink, GstPad * pad,
|
|||
* If buffer list, use the first group buffer within the list
|
||||
* for syncing
|
||||
*/
|
||||
GstBufferListIterator *it;
|
||||
gboolean got_group;
|
||||
|
||||
it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (obj));
|
||||
got_group = gst_buffer_list_iterator_next_group (it);
|
||||
g_assert (got_group);
|
||||
sync_obj = gst_buffer_list_iterator_next (it);
|
||||
gst_buffer_list_iterator_free (it);
|
||||
sync_obj = gst_buffer_list_get (GST_BUFFER_LIST_CAST (obj), 0, 0);
|
||||
g_assert (NULL != sync_obj);
|
||||
} else {
|
||||
sync_obj = obj;
|
||||
|
@ -2850,14 +2843,7 @@ gst_base_sink_preroll_object (GstBaseSink * basesink, gboolean is_list,
|
|||
GstClockTime timestamp;
|
||||
|
||||
if (is_list) {
|
||||
GstBufferListIterator *it;
|
||||
gboolean got_group;
|
||||
|
||||
it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (obj));
|
||||
got_group = gst_buffer_list_iterator_next_group (it);
|
||||
g_assert (got_group);
|
||||
buf = gst_buffer_list_iterator_next (it);
|
||||
gst_buffer_list_iterator_free (it);
|
||||
buf = gst_buffer_list_get (GST_BUFFER_LIST_CAST (obj), 0, 0);
|
||||
g_assert (NULL != buf);
|
||||
} else {
|
||||
buf = GST_BUFFER_CAST (obj);
|
||||
|
@ -3277,14 +3263,7 @@ gst_base_sink_chain_unlocked (GstBaseSink * basesink, GstPad * pad,
|
|||
goto was_eos;
|
||||
|
||||
if (is_list) {
|
||||
GstBufferListIterator *it;
|
||||
gboolean got_group;
|
||||
|
||||
it = gst_buffer_list_iterate (GST_BUFFER_LIST_CAST (obj));
|
||||
got_group = gst_buffer_list_iterator_next_group (it);
|
||||
g_assert (got_group);
|
||||
time_buf = gst_buffer_list_iterator_next (it);
|
||||
gst_buffer_list_iterator_free (it);
|
||||
time_buf = gst_buffer_list_get (GST_BUFFER_LIST_CAST (obj), 0, 0);
|
||||
g_assert (NULL != time_buf);
|
||||
} else {
|
||||
time_buf = GST_BUFFER_CAST (obj);
|
||||
|
|
Loading…
Reference in a new issue