From b5b13a6f5c6f7e878c7b86a953694c8033c09c01 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 16 Jun 2021 01:07:09 +0900 Subject: [PATCH] h265decoder: Don't hold reference to GstVideoCodecFrame for dropped picture We are dropping RASL (Random Access Skipped Leading picture) which is associated with an IRAP (Intra Random Access Picture) that has NoRaslOutputFlag equal to 1, since the RASL picture will not be outputted and also it should not be used for reference picture. So, corresponding GstVideoCodecFrame should be released immediately. Otherwise GstVideoDecoder baseclass will hold the unused frame. Part-of: --- gst-libs/gst/codecs/gsth265decoder.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/codecs/gsth265decoder.c b/gst-libs/gst/codecs/gsth265decoder.c index dc8240fc5a..7b33349a3f 100644 --- a/gst-libs/gst/codecs/gsth265decoder.c +++ b/gst-libs/gst/codecs/gsth265decoder.c @@ -1750,8 +1750,13 @@ gst_h265_decoder_handle_frame (GstVideoDecoder * decoder, return priv->last_ret; } - gst_h265_decoder_finish_current_picture (self); - gst_video_codec_frame_unref (frame); + if (priv->current_picture) { + gst_h265_decoder_finish_current_picture (self); + gst_video_codec_frame_unref (frame); + } else { + /* This picture was dropped */ + gst_video_decoder_release_frame (decoder, frame); + } return priv->last_ret; }