androidcamera: Make sure we always have a valid camera source instance in the buffer free function

This commit is contained in:
Sebastian Dröge 2012-10-26 11:57:47 +02:00 committed by Nicolas Dufresne
parent f43897e839
commit 6cdd4745fe

View file

@ -483,6 +483,7 @@ gst_ahc_src_buffer_free_func (gpointer priv)
if (self->camera)
gst_ah_camera_add_callback_buffer (self->camera, data->array);
(*env)->DeleteGlobalRef (env, data->array);
gst_object_unref (self);
g_slice_free (FreeFuncBuffer, data);
}
@ -526,7 +527,7 @@ gst_ahc_src_on_preview_frame (jbyteArray data, gpointer user_data)
}
//GST_WARNING_OBJECT (self, "Received data buffer %p", data);
malloc_data = g_slice_new0 (FreeFuncBuffer);
malloc_data->self = self;
malloc_data->self = gst_object_ref (self);
malloc_data->array = (*env)->NewGlobalRef (env, data);
malloc_data->data = (*env)->GetByteArrayElements (env, data, NULL);