mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
GstAdapter: Discard empty buffers in _push(). Fixes #574024
This commit is contained in:
parent
2323d50faa
commit
f0481cb717
1 changed files with 19 additions and 11 deletions
|
@ -193,6 +193,8 @@ gst_adapter_clear (GstAdapter * adapter)
|
||||||
*
|
*
|
||||||
* Adds the data from @buf to the data stored inside @adapter and takes
|
* Adds the data from @buf to the data stored inside @adapter and takes
|
||||||
* ownership of the buffer.
|
* ownership of the buffer.
|
||||||
|
* Empty buffers will be automatically dereferenced and not stored in the
|
||||||
|
* @adapter.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_adapter_push (GstAdapter * adapter, GstBuffer * buf)
|
gst_adapter_push (GstAdapter * adapter, GstBuffer * buf)
|
||||||
|
@ -204,6 +206,11 @@ gst_adapter_push (GstAdapter * adapter, GstBuffer * buf)
|
||||||
|
|
||||||
size = GST_BUFFER_SIZE (buf);
|
size = GST_BUFFER_SIZE (buf);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (size == 0)) {
|
||||||
|
GST_LOG_OBJECT (adapter, "discarding empty buffer");
|
||||||
|
gst_buffer_unref (buf);
|
||||||
|
} else {
|
||||||
|
|
||||||
adapter->size += size;
|
adapter->size += size;
|
||||||
|
|
||||||
/* Note: merging buffers at this point is premature. */
|
/* Note: merging buffers at this point is premature. */
|
||||||
|
@ -217,6 +224,7 @@ gst_adapter_push (GstAdapter * adapter, GstBuffer * buf)
|
||||||
adapter->buflist_end = g_slist_append (adapter->buflist_end, buf);
|
adapter->buflist_end = g_slist_append (adapter->buflist_end, buf);
|
||||||
adapter->buflist_end = g_slist_next (adapter->buflist_end);
|
adapter->buflist_end = g_slist_next (adapter->buflist_end);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal function that copies data into the given buffer, size must be
|
/* Internal function that copies data into the given buffer, size must be
|
||||||
|
|
Loading…
Reference in a new issue