提交 d47dd843 编写于 作者: M Michael Niedermayer

Merge commit '577899a6'

* commit '577899a6':
  lavc: specify the behavior of av_lockmgr_register on failure.

Conflicts:
	libavcodec/avcodec.h
	libavcodec/utils.c
	libavcodec/version.h

See: a950edb4Merged-by: NMichael Niedermayer <michaelni@gmx.at>
......@@ -5116,25 +5116,25 @@ enum AVLockOp {
/**
* Register a user provided lock manager supporting the operations
* specified by AVLockOp. The "mutex" argument to the function points
* specified by AVLockOp. The "mutex" argument to the function points
* to a (void *) where the lockmgr should store/get a pointer to a user
* allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
* value left by the last call for all other ops. If the lock manager is
* allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the
* value left by the last call for all other ops. If the lock manager is
* unable to perform the op then it should leave the mutex in the same
* state as when it was called and return a non-zero value. However,
* state as when it was called and return a non-zero value. However,
* when called with AV_LOCK_DESTROY the mutex will always be assumed to
* have been successfully destroyed. If av_lockmgr_register succeeds
* have been successfully destroyed. If av_lockmgr_register succeeds
* it will return a non-negative value, if it fails it will return a
* negative value and destroy all mutex and unregister all callbacks.
* av_lockmgr_register is not thread-safe, it must be called from a
* single thread before any calls which make use of locking are used.
*
* @param cb User defined callback. av_lockmgr_register invokes calls
* @param cb User defined callback. av_lockmgr_register invokes calls
* to this callback and the previously registered callback.
* The callback will be used to create more than one mutex
* each of which must be backed by its own underlying locking
* mechanism (i.e. do not use a single static object to
* implement your lock manager). If cb is set to NULL the
* implement your lock manager). If cb is set to NULL the
* lockmgr will be unregistered.
*/
int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
......
......@@ -3492,12 +3492,12 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op))
void *new_avformat_mutex = NULL;
int err;
if (err = cb(&new_codec_mutex, AV_LOCK_CREATE)) {
return err > 0 ? AVERROR_EXTERNAL : err;
return err > 0 ? AVERROR_UNKNOWN : err;
}
if (err = cb(&new_avformat_mutex, AV_LOCK_CREATE)) {
// Ignore failures to destroy the newly created mutex.
cb(&new_codec_mutex, AV_LOCK_DESTROY);
return err > 0 ? AVERROR_EXTERNAL : err;
return err > 0 ? AVERROR_UNKNOWN : err;
}
lockmgr_cb = cb;
codec_mutex = new_codec_mutex;
......@@ -3536,6 +3536,7 @@ int ff_unlock_avcodec(void)
if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE))
return -1;
}
return 0;
}
......
......@@ -30,7 +30,7 @@
#define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 3
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册