va: Fix a latent race condition in vabasedec.
authorHe Junyan <junyan.he@intel.com>
Fri, 15 Jan 2021 07:22:07 +0000 (15:22 +0800)
committerHe Junyan <junyan.he@intel.com>
Fri, 15 Jan 2021 12:40:10 +0000 (20:40 +0800)
commit6b1e1924fdc7d4b52756f260ce2965f8338601d7
tree0de65aa06dffe9266a4a106f0c78def9550f4477
parent4d07974b103be7b15d3a95cf9703062efed8b683
va: Fix a latent race condition in vabasedec.

The vabasedec's display and decoder are created/destroyed between
the gst_va_base_dec_open/close pair. All the data and event handling
functions are between this pair and so the accessing to these pointers
are safe. But the query function can be called anytime. So we need to:
1. Make these pointers operation in open/close and query atomic.
2. Hold an extra ref during query function to avoid it destroyed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1957>
sys/va/gstvabasedec.c
sys/va/gstvautils.c