mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
ahc: use g_slice_new instead of g_slice_new0
In many cases, we use g_slice_new0 and then immediately overwrite the allocated memory. This is inefficient. Since we're going to immediately overwrite it, we might as well use plain g_slice_new. https://bugzilla.gnome.org/show_bug.cgi?id=763998
This commit is contained in:
parent
66bac3eb86
commit
d6a17cd3cc
2 changed files with 4 additions and 5 deletions
|
@ -2606,7 +2606,7 @@ gst_ah_camera_unlock (GstAHCamera * self)
|
||||||
GstAHCSize *
|
GstAHCSize *
|
||||||
gst_ahc_size_new (gint width, gint height)
|
gst_ahc_size_new (gint width, gint height)
|
||||||
{
|
{
|
||||||
GstAHCSize *self = g_slice_new0 (GstAHCSize);
|
GstAHCSize *self = g_slice_new (GstAHCSize);
|
||||||
|
|
||||||
self->width = width;
|
self->width = width;
|
||||||
self->height = height;
|
self->height = height;
|
||||||
|
@ -3374,8 +3374,7 @@ gst_ahc_parameters_get_preview_size (GstAHCParameters * self)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = g_slice_new0 (GstAHCSize);
|
size = g_slice_new (GstAHCSize);
|
||||||
|
|
||||||
size->width = (*env)->GetIntField (env, jsize,
|
size->width = (*env)->GetIntField (env, jsize,
|
||||||
android_hardware_camera_size.width);
|
android_hardware_camera_size.width);
|
||||||
if ((*env)->ExceptionCheck (env)) {
|
if ((*env)->ExceptionCheck (env)) {
|
||||||
|
|
|
@ -2125,7 +2125,7 @@ gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Received data buffer %p", array);
|
GST_DEBUG_OBJECT (self, "Received data buffer %p", array);
|
||||||
|
|
||||||
malloc_data = g_slice_new0 (FreeFuncBuffer);
|
malloc_data = g_slice_new (FreeFuncBuffer);
|
||||||
malloc_data->self = gst_object_ref (self);
|
malloc_data->self = gst_object_ref (self);
|
||||||
malloc_data->array = (*env)->NewGlobalRef (env, array);
|
malloc_data->array = (*env)->NewGlobalRef (env, array);
|
||||||
malloc_data->data = (*env)->GetByteArrayElements (env, array, NULL);
|
malloc_data->data = (*env)->GetByteArrayElements (env, array, NULL);
|
||||||
|
@ -2140,7 +2140,7 @@ gst_ahc_src_on_preview_frame (jbyteArray array, gpointer user_data)
|
||||||
GST_DEBUG_OBJECT (self, "creating wrapped buffer (size: %d)",
|
GST_DEBUG_OBJECT (self, "creating wrapped buffer (size: %d)",
|
||||||
self->buffer_size);
|
self->buffer_size);
|
||||||
|
|
||||||
item = g_slice_new0 (GstDataQueueItem);
|
item = g_slice_new (GstDataQueueItem);
|
||||||
item->object = GST_MINI_OBJECT (buffer);
|
item->object = GST_MINI_OBJECT (buffer);
|
||||||
item->size = gst_buffer_get_size (buffer);
|
item->size = gst_buffer_get_size (buffer);
|
||||||
item->duration = GST_BUFFER_DURATION (buffer);
|
item->duration = GST_BUFFER_DURATION (buffer);
|
||||||
|
|
Loading…
Reference in a new issue