v4l2allocator: Don't do REQBUFS(0) on inactive allocator
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Fri, 26 Jun 2020 17:10:00 +0000 (13:10 -0400)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 26 Jun 2020 19:24:21 +0000 (19:24 +0000)
If the allocator is no longer active, it means the memory has already
been freed, calling REQBUF(0) would make no sense.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/649>

sys/v4l2/gstv4l2allocator.c

index 4fa5d27..e82a853 100644 (file)
@@ -812,6 +812,9 @@ gst_v4l2_allocator_orphan (GstV4l2Allocator * allocator)
 
   GST_OBJECT_FLAG_SET (allocator, GST_V4L2_ALLOCATOR_FLAG_ORPHANED);
 
+  if (!g_atomic_int_get (&allocator->active))
+    return TRUE;
+
   if (obj->ioctl (obj->video_fd, VIDIOC_REQBUFS, &breq) < 0) {
     GST_ERROR_OBJECT (allocator,
         "error orphaning buffers buffers: %s", g_strerror (errno));