diff options
Diffstat (limited to 'video/out/hwdec/hwdec_cuda.c')
-rw-r--r-- | video/out/hwdec/hwdec_cuda.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/video/out/hwdec/hwdec_cuda.c b/video/out/hwdec/hwdec_cuda.c index 895fb07d61..0fe0f7bda8 100644 --- a/video/out/hwdec/hwdec_cuda.c +++ b/video/out/hwdec/hwdec_cuda.c @@ -253,12 +253,18 @@ static int mapper_map(struct ra_hwdec_mapper *mapper) if (p_owner->do_full_sync) CHECK_CU(cu->cuStreamSynchronize(0)); + // fall through error: - eret = CHECK_CU(cu->cuCtxPopCurrent(&dummy)); - if (eret < 0) - return eret; - return ret; + // Regardless of success or failure, we no longer need the source image, + // because this hwdec makes an explicit memcpy into the mapper textures + mp_image_unrefp(&mapper->src); + + eret = CHECK_CU(cu->cuCtxPopCurrent(&dummy)); + if (eret < 0) + return eret; + + return ret; } const struct ra_hwdec_driver ra_hwdec_cuda = { |