[FFmpeg-devel] why avcodec_open/close() need thread locking?

gw guisheng315 at sina.com.cn
Thu May 31 15:33:43 CEST 2012


hi all

    I see that in avcodec_open/close, there are some code like below:

    /* 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;
    }

    entangled_thread_counter++;
    if(entangled_thread_counter != 1){
        av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around
avcodec_open/close()\n");
        ret = -1;
        goto end;
    }


does it mean that avcodec_open/close() is not thread safe ?

is this lock necessary ?





More information about the ffmpeg-devel mailing list