plugins: encode: fix a deadlock because of _drain()
authorHe Junyan <junyan.he@intel.com>
Wed, 23 Jun 2021 08:23:00 +0000 (16:23 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 1 Jul 2021 11:57:10 +0000 (11:57 +0000)
commit677d1e01051e2ee47439cff7cc7f527bb71afbb8
tree4835ac6c7ed4fd441ae84fb525eb7cb99db20f1e
parentd152ab1d3734e285f3b79ad61bd5facb2364a3af
plugins: encode: fix a deadlock because of _drain()

We call gst_vaapiencode_drain() in gst_vaapiencode_change_state(),
whose context does not hold the stream lock of the encoder. The
current gst_vaapiencode_drain inside unlock/lock pair adds a extra
lock count to the stream lock of encoder and causes hang later.
We just remove the gst_vaapiencode_drain() and expand its logic
correctly according to the lock/unlock context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/433>
gst/vaapi/gstvaapiencode.c