diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 0ae007ad90..d69e1286f5 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6791,6 +6791,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void } if (!(smh = session->media_handle)) { + switch_core_session_rwunlock(session); return NULL; } @@ -7301,12 +7302,14 @@ static void *SWITCH_THREAD_FUNC text_helper_thread(switch_thread_t *thread, void return NULL; } - mh->ready = 1; - if (!(smh = session->media_handle)) { + switch_core_session_rwunlock(session); + mh->ready = -1; return NULL; } + mh->ready = 1; + channel = switch_core_session_get_channel(session); if (switch_channel_var_true(session->channel, "fire_text_events")) { @@ -7460,12 +7463,14 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi return NULL; } - mh->ready = 1; - if (!(smh = session->media_handle)) { + switch_core_session_rwunlock(session); + mh->ready = -1; return NULL; } + mh->ready = 1; + channel = switch_core_session_get_channel(session); switch_core_autobind_cpu();