[FFmpeg-devel] [PATCH] lavc/utils: propagate or return meaningful error codes in avcodec_open2()
Stefano Sabatini
stefasab at gmail.com
Tue Oct 16 13:37:20 CEST 2012
---
libavcodec/utils.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0b0bf9e..6292005 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -826,14 +826,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
/* If there is a user-supplied mutex locking routine, call it. */
if (ff_lockmgr_cb) {
- if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
- return -1;
+ if ((ret = (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) < 0)
+ return ret;
}
entangled_thread_counter++;
if (entangled_thread_counter != 1) {
av_log(avctx, AV_LOG_ERROR, "Insufficient thread locking around avcodec_open/close()\n");
- ret = -1;
+ ret = AVERROR(EINVAL);
goto end;
}
@@ -868,7 +868,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
av_log(avctx, AV_LOG_ERROR,
"Codec %s is experimental but experimental codecs are not enabled, try -strict -2\n",
avctx->codec->name);
- ret = -1;
+ ret = AVERROR(EINVAL);
goto free_and_end;
}
--
1.7.5.4
More information about the ffmpeg-devel
mailing list