mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
androidmedia: Allocate/free texture when camera is open/closed
This commit is contained in:
parent
d4717a9639
commit
dd27b89e95
1 changed files with 5 additions and 5 deletions
|
@ -121,7 +121,7 @@ gst_ahc_src_init (GstAHCSrc * self, GstAHCSrcClass * klass)
|
||||||
gst_base_src_set_do_timestamp (GST_BASE_SRC (self), FALSE);
|
gst_base_src_set_do_timestamp (GST_BASE_SRC (self), FALSE);
|
||||||
|
|
||||||
self->camera = NULL;
|
self->camera = NULL;
|
||||||
self->texture = gst_ag_surfacetexture_new (0);
|
self->texture = NULL;
|
||||||
self->data = NULL;
|
self->data = NULL;
|
||||||
self->queue = gst_data_queue_new (_data_queue_check_full, NULL);
|
self->queue = gst_data_queue_new (_data_queue_check_full, NULL);
|
||||||
self->caps = NULL;
|
self->caps = NULL;
|
||||||
|
@ -134,10 +134,6 @@ gst_ahc_src_dispose (GObject * object)
|
||||||
|
|
||||||
gst_ahc_src_close (self);
|
gst_ahc_src_close (self);
|
||||||
|
|
||||||
if (self->texture)
|
|
||||||
gst_ag_surfacetexture_release (self->texture);
|
|
||||||
self->texture = NULL;
|
|
||||||
|
|
||||||
if (self->queue)
|
if (self->queue)
|
||||||
g_object_unref (self->queue);
|
g_object_unref (self->queue);
|
||||||
self->queue = NULL;
|
self->queue = NULL;
|
||||||
|
@ -301,6 +297,7 @@ gst_ahc_src_open (GstAHCSrc * self)
|
||||||
gst_ag_imageformat_get_bits_per_pixel
|
gst_ag_imageformat_get_bits_per_pixel
|
||||||
(gst_ahc_parameters_get_preview_format (params)) / 8;
|
(gst_ahc_parameters_get_preview_format (params)) / 8;
|
||||||
gst_ahc_size_free (size);
|
gst_ahc_size_free (size);
|
||||||
|
self->texture = gst_ag_surfacetexture_new (0);
|
||||||
gst_ah_camera_set_preview_texture (self->camera, self->texture);
|
gst_ah_camera_set_preview_texture (self->camera, self->texture);
|
||||||
gst_ah_camera_set_error_callback (self->camera, gst_ahc_src_on_error,
|
gst_ah_camera_set_error_callback (self->camera, gst_ahc_src_on_error,
|
||||||
self);
|
self);
|
||||||
|
@ -360,6 +357,9 @@ gst_ahc_src_close (GstAHCSrc * self)
|
||||||
gst_ah_camera_release (self->camera);
|
gst_ah_camera_release (self->camera);
|
||||||
self->camera = NULL;
|
self->camera = NULL;
|
||||||
|
|
||||||
|
if (self->texture)
|
||||||
|
gst_ag_surfacetexture_release (self->texture);
|
||||||
|
self->texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
|
Loading…
Reference in a new issue