[FFmpeg-cvslog] avcodec/videotoolbox: print descriptive errors on decode failures
Aman Gupta
git at videolan.org
Tue Nov 14 00:36:47 EET 2017
ffmpeg | branch: master | Aman Gupta <aman at tmm1.net> | Mon Sep 25 16:44:47 2017 -0700| [6515e2834a51e651aa9855d071291eeb8256dbb6] | committer: Aman Gupta
avcodec/videotoolbox: print descriptive errors on decode failures
Signed-off-by: Aman Gupta <aman at tmm1.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6515e2834a51e651aa9855d071291eeb8256dbb6
---
libavcodec/videotoolbox.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 67b7429274..4fe89a27e9 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -572,9 +572,22 @@ static OSStatus videotoolbox_session_decode_frame(AVCodecContext *avctx)
return status;
}
+static const char *videotoolbox_error_string(OSStatus status)
+{
+ switch (status) {
+ case kVTVideoDecoderBadDataErr:
+ return "bad data";
+ case kVTVideoDecoderMalfunctionErr:
+ return "decoder malfunction";
+ case kVTInvalidSessionErr:
+ return "invalid session";
+ }
+ return "unknown";
+}
+
static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
{
- int status;
+ OSStatus status;
AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
VTContext *vtctx = avctx->internal->hwaccel_priv_data;
@@ -582,9 +595,8 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
return AVERROR_INVALIDDATA;
status = videotoolbox_session_decode_frame(avctx);
-
- if (status) {
- av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%d)\n", status);
+ if (status != noErr) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to decode frame (%s, %d)\n", videotoolbox_error_string(status), (int)status);
return AVERROR_UNKNOWN;
}
More information about the ffmpeg-cvslog
mailing list