2012/9/2 Luca Barbato <lu_z...@gentoo.org>:

>  static int volatile entangled_thread_counter=0;
> +#if HAVE_PTHREADS || HAVE_W32THREADS
> +static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op) =
> +    ff_pthread_lockmgr_cb;
> +#else
>  static int (*ff_lockmgr_cb)(void **mutex, enum AVLockOp op);
> +#endif

There's a problem.
You initialize statically the function pointer.
But in other places code suspects that no function is registered by
default, and on the callback registration event it creates
avformat_mutex and avcodec_mutex.
With current patch it crashed for me on
#0  __pthread_mutex_lock (mutex=0x0) at pthread_mutex_lock.c:50
#1  0x0000000000740828 in ff_pthread_lockmgr_cb ()
#2  0x000000000074d3be in avpriv_lock_avformat ()
#3  0x0000000000501da9 in ff_tls_init ()
#4  0x0000000000505d3f in avformat_network_init ()
the trace is poor, but you get the idea.

So we should either register this callback implementation at runtime,
or create avformat_mutex, avcodec_mutex at runtime with a separate
call.

-- 
Andrey Utkin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to