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

Steve Lhomme robux4 at ycbcr.xyz
Thu Mar 12 17:24:37 CET 2020


LGTM

It seems only the block structure leaked. Not the data inside. I don't 
see much change in the memory usage during playback without this patch.

On 2020-03-12 15:31, quentin.chateau at deepskycorp.com wrote:
> 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
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list