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 <softwo...@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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to