mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
adapter: use g_realloc for resizing the buffer
Use g_realloc for resizing the internal buffer instead of a less fancy _free/_malloc pair.
This commit is contained in:
parent
bb013081a4
commit
cc7985ab48
1 changed files with 4 additions and 4 deletions
|
@ -398,12 +398,12 @@ gst_adapter_peek (GstAdapter * adapter, guint size)
|
|||
}
|
||||
|
||||
/* Gonna need to copy stuff out */
|
||||
if (adapter->assembled_size < size) {
|
||||
if (G_UNLIKELY (adapter->assembled_size < size)) {
|
||||
adapter->assembled_size = (size / DEFAULT_SIZE + 1) * DEFAULT_SIZE;
|
||||
GST_DEBUG_OBJECT (adapter, "setting size of internal buffer to %u",
|
||||
GST_DEBUG_OBJECT (adapter, "resizing internal buffer to %u",
|
||||
adapter->assembled_size);
|
||||
g_free (adapter->assembled_data);
|
||||
adapter->assembled_data = g_malloc (adapter->assembled_size);
|
||||
adapter->assembled_data =
|
||||
g_realloc (adapter->assembled_data, adapter->assembled_size);
|
||||
}
|
||||
adapter->assembled_len = size;
|
||||
|
||||
|
|
Loading…
Reference in a new issue