This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/8.1 in repository ffmpeg.
commit 1eb34ecab7dd8dadba64280df99152bf38797826 Author: KawaiiEngine (Sashimiso) <[email protected]> AuthorDate: Wed Jul 15 05:39:29 2026 +0900 Commit: Michael Niedermayer <[email protected]> CommitDate: Sun Nov 29 05:56:35 2026 +0100 avutil/hwcontext_cuda: drain queued copies on transfer error cuda_transfer_data() can enqueue copies for earlier planes before a later cuArrayGetPlane() or cuMemcpy2DAsync() fails. Returning at that point can let queued work outlive caller-owned AVFrame buffers. Track whether a copy was successfully queued and synchronize the stream on these later failures. Synchronization is best-effort: its errors and cuCtxPopCurrent() errors stay logged without replacing the primary failure. Successful H2D and D2D transfers remain asynchronous, and the normal host-download synchronization path is unchanged. Signed-off-by: KawaiiEngine (Sashimiso) <[email protected]> (cherry picked from commit 0f1e9710896108e8aa7f60f8b1c6d16333eab2ae) Signed-off-by: Michael Niedermayer <[email protected]> --- libavutil/hwcontext_cuda.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c index b34a211897..816de177d7 100644 --- a/libavutil/hwcontext_cuda.c +++ b/libavutil/hwcontext_cuda.c @@ -244,7 +244,7 @@ static int cuda_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, CudaFunctions *cu = hwctx->internal->cuda_dl; CUcontext dummy; - int i, ret; + int i, ret, copy_queued = 0; if ((src->hw_frames_ctx && ((AVHWFramesContext*)src->hw_frames_ctx->data)->format != AV_PIX_FMT_CUDA) || (dst->hw_frames_ctx && ((AVHWFramesContext*)dst->hw_frames_ctx->data)->format != AV_PIX_FMT_CUDA)) @@ -258,7 +258,7 @@ static int cuda_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, int bytewidth = av_image_get_linesize(ctx->sw_format, src->width, i); if (bytewidth < 0) { ret = bytewidth; - goto exit; + goto fail; } CUDA_MEMCPY2D cpy = { @@ -286,7 +286,8 @@ static int cuda_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, ret = CHECK_CU(cu->cuMemcpy2DAsync(&cpy, hwctx->stream)); if (ret < 0) - goto exit; + goto fail; + copy_queued = 1; } if (!dst->hw_frames_ctx) { @@ -295,6 +296,9 @@ static int cuda_transfer_data(AVHWFramesContext *ctx, AVFrame *dst, goto exit; } +fail: + if (ret < 0 && copy_queued) + CHECK_CU(cu->cuStreamSynchronize(hwctx->stream)); exit: CHECK_CU(cu->cuCtxPopCurrent(&dummy)); -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
