[FFmpeg-devel] [PATCH] lavc/utils: propagate or return meaningful error codes in avcodec_open2()

Paul B Mahol onemda at gmail.com
Wed Oct 24 00:07:44 CEST 2012


On 10/16/12, Stefano Sabatini <stefasab at gmail.com> wrote:
> ---
>  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);
AVERROR_EXPERIMENTAL ?
>              goto free_and_end;
>          }
>
> --
> 1.7.5.4
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list