2b131d212f
Per mbedtls documentation, "If you share a context between threads, you need to call these functions only from the main thread, at the beginning and end of the context's lifetime.". OBS violated this since librtmp uses a global context and it was allocated and freed in different threads such as the auto config test. This commit attaches the mbedtls context to an RTMP structure so there is no more global state. It also fixes a rare double-free crash that could occur if RTMP_TLS_Free was called twice (this happened in rare situations such as the auto config running followed by a mode change from Advanced to Simple).