[Bug 742074] v4l2videodec: leaks filedescriptors

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Aug 2 08:53:23 UTC 2018


https://bugzilla.gnome.org/show_bug.cgi?id=742074

kevin <kevinbing.song at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kevinbing.song at gmail.com

--- Comment #5 from kevin <kevinbing.song at gmail.com> ---
Below code cause race condition when gst-launch-1.0 videotestsrc ! v4l2videoenc
! fakesink


out->pool == NULL will race with _gst_video_codec_frame_free() in
gst_video_encoder_finish_frame(). Can I only revert below code without other
code change? Is there any potential issue?


@@ -1781,15 +1781,19 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool,
GstBuffer ** buf)
             goto start_failed;
           }

+          /* Remove our ref, we will still hold this buffer in acquire as
needed,
+           * otherwise the pool will think it is outstanding and will refuse
to stop. */
+          gst_buffer_unref (to_queue);
+
           if (g_atomic_int_get (&pool->num_queued) >= pool->min_latency) {
             GstBuffer *out;
             /* all buffers are queued, try to dequeue one and release it back
              * into the pool so that _acquire can get to it again. */
             ret = gst_v4l2_buffer_pool_dqbuf (pool, &out);
-            if (ret == GST_FLOW_OK)
+            if (ret == GST_FLOW_OK && out->pool == NULL)
               /* release the rendered buffer back into the pool. This wakes up
any
                * thread waiting for a buffer in _acquire(). */
-              gst_buffer_unref (out);
+              gst_v4l2_buffer_pool_release_buffer (bpool, out);
           }
           break;
         }

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list