mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-16 03:50:05 +01:00
avcodec: Do not lock during init if there is no init function
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
committed by
Luca Barbato
parent
34ed5c2e4d
commit
17e41cf361
@@ -845,7 +845,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
|
|||||||
av_dict_copy(&tmp, *options, 0);
|
av_dict_copy(&tmp, *options, 0);
|
||||||
|
|
||||||
/* If there is a user-supplied mutex locking routine, call it. */
|
/* If there is a user-supplied mutex locking routine, call it. */
|
||||||
if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)) {
|
if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) {
|
||||||
if (lockmgr_cb) {
|
if (lockmgr_cb) {
|
||||||
if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
|
if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1086,7 +1086,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
end:
|
end:
|
||||||
if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE)) {
|
if (!(codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE) && codec->init) {
|
||||||
entangled_thread_counter--;
|
entangled_thread_counter--;
|
||||||
|
|
||||||
/* Release any user-supplied mutex. */
|
/* Release any user-supplied mutex. */
|
||||||
|
|||||||
Reference in New Issue
Block a user