androidcamera: Calling set_preview_callback with NULL frees all the buffers in the queue.

We must not do it at the stop otherwise we lose all our buffers. It's best to do
it during the close, so we free up the resources.
This commit is contained in:
Youness Alaoui 2012-10-30 09:49:39 -04:00 committed by Nicolas Dufresne
parent acb15e4178
commit 122083eadb

View file

@ -606,8 +606,11 @@ gst_ahc_src_open (GstAHCSrc * self)
static void
gst_ahc_src_close (GstAHCSrc * self)
{
if (self->camera)
if (self->camera) {
gst_ah_camera_set_error_callback (self->camera, NULL, NULL);
gst_ah_camera_set_preview_callback_with_buffer (self->camera, NULL, NULL);
gst_ah_camera_release (self->camera);
}
self->camera = NULL;
if (self->texture)
@ -698,7 +701,6 @@ gst_ahc_src_stop (GstBaseSrc * bsrc)
if (self->camera) {
gst_data_queue_flush (self->queue);
self->start = FALSE;
gst_ah_camera_set_preview_callback_with_buffer (self->camera, NULL, NULL);
gst_ah_camera_set_error_callback (self->camera, NULL, NULL);
return gst_ah_camera_stop_preview (self->camera);
}