va: Destroy picture unreleased buffers when finalize.
authorHe Junyan <junyan.he@intel.com>
Thu, 26 Nov 2020 06:04:31 +0000 (14:04 +0800)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Mon, 30 Nov 2020 13:03:11 +0000 (13:03 +0000)
commitf5c7ada98ed5070f07c10fe0c13e17cf8b7ae922
treed408f09c213294debe4d9169ec29d7c456551e17
parentd608636327f5596d03dc3a623413857fd83e84aa
va: Destroy picture unreleased buffers when finalize.

The current way of GstVaDecodePicture's finalize will leak some
resource such as parameter buffers and slice data.
The current way deliberately leaves these resource releasing logic
to va decoder related function and trigger a warning if we free the
GstVaDecodePicture without releasing these resources.
But in practice, sometimes, you do not have the chance to release
these resource before picture is freed. For example, H264/Mpeg2
support multi slice NALs/Packets for one frame. It is possible that
we already succeed to parse and generate the first several slices
data by _decode_slice(), but then we get a wrong slice NAL/packet
and fail to parse it. We decide to discard the whole frame in the
decoder's base class, it just free the current picture and does not
trigger sub class's function again. In this kind of cases, we do
not have the chance to cleanup the resource, and the resource will
be leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1841>
sys/va/gstvadecoder.c
sys/va/gstvadecoder.h
sys/va/gstvah264dec.c
sys/va/gstvah265dec.c
sys/va/gstvavp8dec.c
sys/va/gstvavp9dec.c