[vlc-devel] [PATCH] nvdec: release used video blocks

quentin.chateau at deepskycorp.com quentin.chateau at deepskycorp.com
Thu Mar 12 15:31:25 CET 2020


From: Quentin Chateau <quentin.chateau at deepskycorp.com>

---
 modules/hw/nvdec/nvdec.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index e5cda56ef3..162330788f 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -549,7 +549,9 @@ static int CuvidPushBlock(decoder_t *p_dec, block_t *p_block)
     cupacket.payload = p_block->p_buffer;
     cupacket.timestamp = p_block->i_pts == VLC_TICK_INVALID ? p_block->i_dts : p_block->i_pts;
 
-    return CALL_CUVID(cuvidParseVideoData, p_sys->cuparser, &cupacket);
+    int ret = CALL_CUVID(cuvidParseVideoData, p_sys->cuparser, &cupacket);
+    block_Release(p_block);
+    return ret;
 }
 
 static block_t * HXXXProcessBlock(decoder_t *p_dec, block_t *p_block)
@@ -612,8 +614,12 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
 {
     nvdec_ctx_t *p_sys = p_dec->p_sys;
     // If HandleVideoSequence fails, we give up decoding
-    if (!p_sys->b_nvparser_success)
+    if (!p_sys->b_nvparser_success) {
+        if (p_block != NULL) {
+            block_Release(p_block);
+        }
         return VLCDEC_ECRITICAL;
+    }
     if (p_block == NULL) {
         // Flush stream
         return CuvidPushEOS(p_dec);
-- 
2.17.1



More information about the vlc-devel mailing list