summaryrefslogtreecommitdiff
path: root/sys/va/gstvavp9dec.c
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2020-11-26 14:04:31 +0800
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-11-30 13:03:11 +0000
commitf5c7ada98ed5070f07c10fe0c13e17cf8b7ae922 (patch)
treed408f09c213294debe4d9169ec29d7c456551e17 /sys/va/gstvavp9dec.c
parentd608636327f5596d03dc3a623413857fd83e84aa (diff)
downloadgstreamer-plugins-bad-f5c7ada98ed5070f07c10fe0c13e17cf8b7ae922.tar.gz
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>
Diffstat (limited to 'sys/va/gstvavp9dec.c')
-rw-r--r--sys/va/gstvavp9dec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/va/gstvavp9dec.c b/sys/va/gstvavp9dec.c
index 0d7a2716a..b1657ea8b 100644
--- a/sys/va/gstvavp9dec.c
+++ b/sys/va/gstvavp9dec.c
@@ -198,12 +198,13 @@ gst_va_vp9_dec_new_picture (GstVp9Decoder * decoder,
GstVaVp9Dec *self = GST_VA_VP9_DEC (decoder);
GstVaDecodePicture *pic;
GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
+ GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
ret = gst_video_decoder_allocate_output_frame (vdec, frame);
if (ret != GST_FLOW_OK)
goto error;
- pic = gst_va_decode_picture_new (frame->output_buffer);
+ pic = gst_va_decode_picture_new (base->decoder, frame->output_buffer);
gst_vp9_picture_set_user_data (picture, pic,
(GDestroyNotify) gst_va_decode_picture_free);