v4l2videodec: Add ref/unref code to avoid crash 00/260700/1 accepted/tizen/unified/20210707.070822 submit/tizen/20210702.012922 submit/tizen/20210705.030138
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 1 Jul 2021 08:06:46 +0000 (17:06 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 1 Jul 2021 08:12:27 +0000 (17:12 +0900)
- The crash could be occurred when a buffer from v4l2allocator is returned after the element is released.
- This patch prevents release of element until all buffers are returned.

[Version] 1.16.2-28
[Issue Type] Improvement

Change-Id: I5a17788254e30d0601bd6463f9b84c539f1815a6
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/gst-plugins-good.spec
sys/v4l2/gstv4l2bufferpool.c

index 5e37d38..221a040 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:           gst-plugins-good
 Version:        1.16.2
-Release:        27
+Release:        28
 License:        LGPL-2.1+
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 Url:            http://gstreamer.freedesktop.org/
index 4d94937..494b5b8 100644 (file)
@@ -104,6 +104,8 @@ static void gst_v4l2_tizen_buffer_finalize (GstV4l2TizenBuffer *tizen_buffer)
 
   g_mutex_unlock (&pool->buffer_lock);
 
+  gst_object_unref (pool);
+
   g_free(tizen_buffer);
 }
 
@@ -116,7 +118,7 @@ static GstV4l2TizenBuffer *gst_v4l2_tizen_buffer_new (GstBuffer *v4l2_buffer, in
   tizen_buffer->index = index;
   tizen_buffer->v4l2_buffer = v4l2_buffer;
   tizen_buffer->gst_buffer = gst_buffer_new ();
-  tizen_buffer->v4l2_pool = v4l2_pool;
+  tizen_buffer->v4l2_pool = gst_object_ref (v4l2_pool);
 
   memory = gst_tizen_allocator_alloc_surface (v4l2_pool->tallocator,
       &v4l2_pool->obj->info, v4l2_pool->vallocator->groups[index]->surface, (gpointer)tizen_buffer,