[FFmpeg-devel] [PATCH 5/9] avcodec/videotoolbox: print descriptive errors on decode failures

Aman Gupta ffmpeg at tmm1.net
Tue Sep 26 03:36:27 EEST 2017


From: Aman Gupta <aman at tmm1.net>

---
 libavcodec/videotoolbox.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 1de556f3e8..f56ab1f8c9 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -425,7 +425,22 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
     status = videotoolbox_session_decode_frame(avctx);
 
     if (status) {
-        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);
+        const char *error = NULL;
+        switch (status) {
+            case kVTVideoDecoderBadDataErr:
+                error = "bad data";
+                break;
+            case kVTVideoDecoderMalfunctionErr:
+                error = "decoder malfunction";
+                break;
+            case kVTInvalidSessionErr:
+                error = "invalid session";
+                break;
+            default:
+                error = "unknown";
+                break;
+        }
+        av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%s, %d)\n", error, status);
         return AVERROR_UNKNOWN;
     }
 
-- 
2.13.5 (Apple Git-94)



More information about the ffmpeg-devel mailing list