From 49e64005c4ed0a09ccf9ccb2b0e7521e64d21efd Mon Sep 17 00:00:00 2001 From: Michael Grzeschik Date: Wed, 23 Jun 2010 11:47:43 +0200 Subject: [PATCH 2/2] [gstv4l2sink] destroy open buffers when changing to NULL In the case we change the State from READY_TO_NULL the open buffers still hold a open dup filedescriptor to the device, therefor the device release function will not be called and the device probably answer with -EBUSY when we reopen it at transition NULL_TO_READY. Signed-off-by: Michael Grzeschik --- sys/v4l2/gstv4l2sink.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) Index: gst-plugins-good-0.10.23/sys/v4l2/gstv4l2sink.c =================================================================== --- gst-plugins-good-0.10.23.orig/sys/v4l2/gstv4l2sink.c 2010-06-23 17:36:47.000000000 +0200 +++ gst-plugins-good-0.10.23/sys/v4l2/gstv4l2sink.c 2010-06-23 17:36:55.000000000 +0200 @@ -461,6 +461,8 @@ } break; case GST_STATE_CHANGE_READY_TO_NULL: + gst_v4l2_buffer_pool_destroy(v4l2sink->pool); + v4l2sink->pool=NULL; /* close the device */ if (!gst_v4l2_object_stop (v4l2sink->v4l2object)) return GST_STATE_CHANGE_FAILURE; @@ -557,13 +559,7 @@ } if (v4l2sink->pool) { - /* TODO: if we've already allocated buffers, we probably need to - * do something here to free and reallocate.... - * - * gst_v4l2_object_stop_streaming() - * gst_v4l2_buffer_pool_destroy() - * - */ + gst_v4l2_object_stop_streaming(v4l2sink->v4l2object); GST_DEBUG_OBJECT (v4l2sink, "warning, changing caps not supported yet"); return FALSE; }