mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
adapter: avoid multiple calls to gst_buffer_get_size() in macro
This commit is contained in:
parent
5253a4d879
commit
4a1cee3c44
1 changed files with 6 additions and 4 deletions
|
@ -795,10 +795,11 @@ gst_adapter_take_buffer_fast (GstAdapter * adapter, gsize nbytes)
|
|||
}
|
||||
|
||||
for (item = adapter->buflist; item && left > 0; item = item->next) {
|
||||
gsize size;
|
||||
gsize size, cur_size;
|
||||
|
||||
cur = item->data;
|
||||
size = MIN (gst_buffer_get_size (cur) - skip, left);
|
||||
cur_size = gst_buffer_get_size (cur);
|
||||
size = MIN (cur_size - skip, left);
|
||||
|
||||
GST_LOG_OBJECT (adapter, "appending %" G_GSIZE_FORMAT " bytes"
|
||||
" via region copy", size);
|
||||
|
@ -924,7 +925,7 @@ gst_adapter_take_list (GstAdapter * adapter, gsize nbytes)
|
|||
{
|
||||
GQueue queue = G_QUEUE_INIT;
|
||||
GstBuffer *cur;
|
||||
gsize hsize, skip;
|
||||
gsize hsize, skip, cur_size;
|
||||
|
||||
g_return_val_if_fail (GST_IS_ADAPTER (adapter), NULL);
|
||||
g_return_val_if_fail (nbytes <= adapter->size, NULL);
|
||||
|
@ -934,7 +935,8 @@ gst_adapter_take_list (GstAdapter * adapter, gsize nbytes)
|
|||
while (nbytes > 0) {
|
||||
cur = adapter->buflist->data;
|
||||
skip = adapter->skip;
|
||||
hsize = MIN (nbytes, gst_buffer_get_size (cur) - skip);
|
||||
cur_size = gst_buffer_get_size (cur);
|
||||
hsize = MIN (nbytes, cur_size - skip);
|
||||
|
||||
cur = gst_adapter_take_buffer (adapter, hsize);
|
||||
|
||||
|
|
Loading…
Reference in a new issue