diff --git a/plugins/obs-outputs/librtmp/rtmp.c b/plugins/obs-outputs/librtmp/rtmp.c index 7310b4b1c..0cd64101c 100644 --- a/plugins/obs-outputs/librtmp/rtmp.c +++ b/plugins/obs-outputs/librtmp/rtmp.c @@ -420,7 +420,7 @@ RTMP_TLS_Init(RTMP *r) void RTMP_TLS_Free(RTMP *r) { -#ifdef USE_MBEDTLS +#if defined(CRYPTO) && defined(USE_MBEDTLS) if (!r->RTMP_TLS_ctx) return; @@ -451,9 +451,7 @@ RTMP_Alloc() void RTMP_Free(RTMP *r) { -#if defined(CRYPTO) && defined(USE_MBEDTLS) RTMP_TLS_Free(r); -#endif free(r); } @@ -463,11 +461,7 @@ RTMP_Init(RTMP *r) memset(r, 0, sizeof(RTMP)); r->m_sb.sb_socket = -1; RTMP_Reset(r); - -#ifdef CRYPTO RTMP_TLS_Init(r); -#endif - } void diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index 797a8c12c..85d0ce34e 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -154,7 +154,6 @@ static void *rtmp_stream_create(obs_data_t *settings, obs_output_t *output) pthread_mutex_init_value(&stream->packets_mutex); RTMP_LogSetCallback(log_rtmp); - RTMP_Init(&stream->rtmp); RTMP_LogSetLevel(RTMP_LOGWARNING); if (pthread_mutex_init(&stream->packets_mutex, NULL) != 0) @@ -1050,19 +1049,10 @@ static int try_connect(struct rtmp_stream *stream) info("Connecting to RTMP URL %s...", stream->path.array); - // on reconnect we need to reset the internal variables of librtmp - // otherwise the data sent/received will not parse correctly on the other end - RTMP_Reset(&stream->rtmp); - - // apparently TLS will not properly persist through connections + // free any existing RTMP TLS context RTMP_TLS_Free(&stream->rtmp); - RTMP_TLS_Init(&stream->rtmp); - // since we don't call RTMP_Init above, there's no other good place - // to reset this as doing it in RTMP_Close breaks the ugly RTMP - // authentication system - memset(&stream->rtmp.Link, 0, sizeof(stream->rtmp.Link)); - stream->rtmp.last_error_code = 0; + RTMP_Init(&stream->rtmp); if (!RTMP_SetupURL(&stream->rtmp, stream->path.array)) return OBS_OUTPUT_BAD_PATH;