rtmpsrc: Crash due to unsafe thread handling in librtmp when setting state from PLAYING->PAUSED
@mruprecht
Submitted by Mike Ruprecht Link to original bug (#729099)
Description
Created attachment 275318
Log including relevant GST_DEBUG output and the backtrace
I've stumbled across a crash in rtmpsrc which happens due to RTMP_Close() being called in gst_rtmp_src_unlock() while RTMP_Read() is being run in gst_rtmp_src_create() in another thread. librtmp isn't thread safe so this case is bad.
The only solution I've managed to come up with is to call RTMPSockBuf_Close() in gst_rtmp_src_unlock() to close the socket and block until RTMP_Read() returns in error. This is not ideal as RTMP_Close() sends some packets out before closing the socket, which would be missed with the above solution. Hopefully there's a better solution I'm not aware of.
Attachment 275318, "Log including relevant GST_DEBUG output and the backtrace":
crash.log
Version: 1.2.4