lavc/utils: propagate or return meaningful error codes in avcodec_open2()

This commit is contained in:
Stefano Sabatini 2012-10-16 13:30:52 +02:00
parent 2fdc6f355c
commit 5ffadec30a
1 changed files with 3 additions and 3 deletions

View File

@ -849,14 +849,14 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
/* If there is a user-supplied mutex locking routine, call it. */ /* If there is a user-supplied mutex locking routine, call it. */
if (ff_lockmgr_cb) { if (ff_lockmgr_cb) {
if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) if ((ret = (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) < 0)
return -1; return ret;
} }
entangled_thread_counter++; entangled_thread_counter++;
if (entangled_thread_counter != 1) { if (entangled_thread_counter != 1) {
av_log(avctx, AV_LOG_ERROR, "Insufficient thread locking around avcodec_open/close()\n"); av_log(avctx, AV_LOG_ERROR, "Insufficient thread locking around avcodec_open/close()\n");
ret = -1; ret = AVERROR(EINVAL);
goto end; goto end;
} }