[FFmpeg-devel] [PATCH 2/2] avutil/cuda_check: request application exit when CUDA_ERROR_UNKNOWN is received
Soft Works
softworkz at hotmail.com
Tue Oct 19 02:24:46 EEST 2021
We've seen a case where an error from cuvid api is ending up in
an endless loop, creating a log file of > 10 GB like this:
[h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error
Error while decoding stream #0:0: Generic error in an external library
[h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error
Error while decoding stream #0:0: Generic error in an external library
[h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error
Error while decoding stream #0:0: Generic error in an external library
[h264_cuvid @ 0xda1b40] ctx->cvdl->cuvidParseVideoData(ctx->cuparser, &cupkt) failed -> CUDA_ERROR_UNKNOWN: unknown error
This patch maps CUDA_ERROR_UNKNOWN to AVERROR_EXIT to make sure that
the application will stop.
Signed-off-by: softworkz <softworkz at hotmail.com>
---
libavutil/cuda_check.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavutil/cuda_check.h b/libavutil/cuda_check.h
index 3aea085c07..8c54afff14 100644
--- a/libavutil/cuda_check.h
+++ b/libavutil/cuda_check.h
@@ -25,6 +25,8 @@
typedef CUresult CUDAAPI cuda_check_GetErrorName(CUresult error, const char** pstr);
typedef CUresult CUDAAPI cuda_check_GetErrorString(CUresult error, const char** pstr);
+#define CUDA_ERROR_UNKNOWN 999
+
/**
* Wrap a CUDA function call and print error information if it fails.
*/
@@ -48,6 +50,10 @@ static inline int ff_cuda_check(void *avctx,
av_log(avctx, AV_LOG_ERROR, " -> %s: %s", err_name, err_string);
av_log(avctx, AV_LOG_ERROR, "\n");
+ // Not recoverable, request application exit
+ if (err == CUDA_ERROR_UNKNOWN)
+ return AVERROR_EXIT;
+
return AVERROR_EXTERNAL;
}
--
2.17.1
More information about the ffmpeg-devel
mailing list