[vlc-devel] [PATCH 1/2] nvdec: added missing CUDA context pop in error path
quentin.chateau at deepskycorp.com
quentin.chateau at deepskycorp.com
Mon Mar 23 18:11:40 CET 2020
From: Quentin Chateau <quentin.chateau at deepskycorp.com>
---
modules/hw/nvdec/nvdec.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index 321815071d..d2ec909fbc 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -227,7 +227,7 @@ static int CUDAAPI HandleVideoSequence(void *p_opaque, CUVIDEOFORMAT *p_format)
};
ret = CALL_CUVID(cuvidCreateDecoder, &p_sys->cudecoder, &dparams);
if (ret != VLC_SUCCESS)
- goto error;
+ goto cuda_error;
// ensure the output surfaces have the same pitch so copies can work properly
if ( is_nvdec_opaque(p_dec->fmt_out.video.i_chroma) )
@@ -240,7 +240,7 @@ static int CUDAAPI HandleVideoSequence(void *p_opaque, CUVIDEOFORMAT *p_format)
};
ret = CALL_CUVID( cuvidMapVideoFrame, p_sys->cudecoder, 0, &frameDevicePtr, &p_sys->outputPitch, ¶ms );
if (ret != VLC_SUCCESS)
- goto error;
+ goto cuda_error;
CALL_CUVID(cuvidUnmapVideoFrame, p_sys->cudecoder, frameDevicePtr);
unsigned int ByteWidth = p_sys->outputPitch;
@@ -294,7 +294,7 @@ clean_pics:
break;
}
if (ret != VLC_SUCCESS)
- goto error;
+ goto cuda_error;
p_sys->out_pool = picture_pool_New( ARRAY_SIZE(p_sys->outputDevicePtr), pics );
}
@@ -305,6 +305,9 @@ clean_pics:
ret = decoder_UpdateVideoOutput(p_dec, p_sys->vctx_out);
return (ret == VLC_SUCCESS);
+
+cuda_error:
+ CALL_CUDA_DEC(cuCtxPopCurrent, NULL);
error:
p_sys->b_nvparser_success = false;
return 0;
--
2.17.1
More information about the vlc-devel
mailing list