提交 79069c66 authored 作者: William King's avatar William King

FS-3882, FS-3546, FS-3712, FS-3970: --resolve Fixes the segfault in mod_rtmp…

FS-3882, FS-3546, FS-3712, FS-3970: --resolve Fixes the segfault in mod_rtmp where the channel was destroyed, but the endpoint still tried to send or receive data from the session.
上级 9b336755
...@@ -250,6 +250,7 @@ switch_status_t rtmp_on_hangup(switch_core_session_t *session) ...@@ -250,6 +250,7 @@ switch_status_t rtmp_on_hangup(switch_core_session_t *session)
tech_pvt = switch_core_session_get_private(session); tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL); assert(tech_pvt != NULL);
switch_thread_rwlock_wrlock(tech_pvt->rtmp_session->rwlock);
switch_clear_flag_locked(tech_pvt, TFLAG_IO); switch_clear_flag_locked(tech_pvt, TFLAG_IO);
//switch_thread_cond_signal(tech_pvt->cond); //switch_thread_cond_signal(tech_pvt->cond);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel)); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
...@@ -286,6 +287,8 @@ switch_status_t rtmp_on_hangup(switch_core_session_t *session) ...@@ -286,6 +287,8 @@ switch_status_t rtmp_on_hangup(switch_core_session_t *session)
} }
#endif #endif
switch_thread_rwlock_unlock(tech_pvt->rtmp_session->rwlock);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
...@@ -906,10 +906,12 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession) ...@@ -906,10 +906,12 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
rtmp_handle_invoke(rsession, rsession->amfnumber); rtmp_handle_invoke(rsession, rsession->amfnumber);
break; break;
case RTMP_TYPE_AUDIO: /* Audio data */ case RTMP_TYPE_AUDIO: /* Audio data */
switch_thread_rwlock_wrlock(rsession->rwlock);
if (rsession->tech_pvt) { if (rsession->tech_pvt) {
uint16_t len = state->origlen; uint16_t len = state->origlen;
if (!rsession->tech_pvt->readbuf) { if (!rsession->tech_pvt->readbuf) {
switch_thread_rwlock_unlock(rsession->rwlock);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
...@@ -936,6 +938,8 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession) ...@@ -936,6 +938,8 @@ switch_status_t rtmp_handle_data(rtmp_session_t *rsession)
} }
switch_mutex_unlock(rsession->tech_pvt->readbuf_mutex); switch_mutex_unlock(rsession->tech_pvt->readbuf_mutex);
} }
switch_thread_rwlock_unlock(rsession->rwlock);
break; break;
case RTMP_TYPE_VIDEO: /* Video data */ case RTMP_TYPE_VIDEO: /* Video data */
case RTMP_TYPE_METADATA: /* Metadata */ case RTMP_TYPE_METADATA: /* Metadata */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论