[rtmpdump] librtmp thread-safeness question
funman at videolan.org
Wed Dec 17 09:25:27 CET 2014
Le 16/12/2014 12:46, Andrey Turkin a écrit :
> Hi all,
> I've run into an issue with streaming to RTMP server (via libav) in
> multithreaded application - it would sometimes crash at start.
> Debugging revealed following (reduced) callstack:
> my application
> After reading openssl/librtmp/libav code it seems to me that there is
> not one but two different race conditions. Firstly, there is an
> obvious race in RTMP_Init before and during the call to RTMP_TLS_Init.
Check this patch:
> Secondly, although openssl is supposed to be threadsafe, it is only
> true if its threading support is initialized via CRYPTO_thread_setup
> or alternative code which does something similar.
> I don't know if that is a bug in librtmp or incorrect usage by libav
> or something else.
> So, my question is whether librtmp is supposed to be thread-safe to a
> some degree; and if it is then which API calls are supposed to be
> thread-safe and which are not. I saw a message in this list which said
> calling librtmp functions with same session handle from different
> threads is not safe (which makes sense) but I cannot find any
> information about what usage should be safe.
> From what I can see (with regard to not initialized openssl threading)
> it looks like librtmp is not thread-safe as a whole and all calls to
> it must be serialized.
> Andrey Turkin
> rtmpdump mailing list
> rtmpdump at mplayerhq.hu
More information about the rtmpdump