diff mbox series

[FFmpeg-devel,2/2] avutil/cuda_check: request application exit when CUDA_ERROR_UNKNOWN is received

Message ID MN2PR04MB5981C6CE8CC5F161673BFD41BABC9@MN2PR04MB5981.namprd04.prod.outlook.com
State Withdrawn, archived
Headers show
Series [FFmpeg-devel,1/2] fftools/ffmpeg: exit application when decoding returns AVERROR_EXIT
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Soft Works Oct. 18, 2021, 11:24 p.m. UTC
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@hotmail.com>
---
 libavutil/cuda_check.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

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;
 }