提交 fae50b41 authored 作者: Anthony Minessale's avatar Anthony Minessale

prevent buffer destroy race

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13219 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 e9c8418a
......@@ -915,6 +915,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
} else {
switch_size_t x;
for (x = 0; x < frames; x++) {
if (switch_channel_down(session->channel) || !session->raw_write_buffer) {
goto error;
}
if ((session->raw_write_frame.datalen = (uint32_t)
switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, bytes)) != 0) {
int rate;
......
......@@ -879,9 +879,15 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, s
switch_mutex_unlock(session->resample_mutex);
/* clear indications */
switch_core_session_flush_message(session);
/* wipe these, they will be recreated if need be */
switch_buffer_destroy(&session->raw_read_buffer);
switch_mutex_lock(session->codec_write_mutex);
switch_buffer_destroy(&session->raw_write_buffer);
switch_mutex_unlock(session->codec_write_mutex);
switch_mutex_lock(session->codec_read_mutex);
switch_buffer_destroy(&session->raw_read_buffer);
switch_mutex_unlock(session->codec_read_mutex);
if (flush_dtmf) {
while ((has = switch_channel_has_dtmf(channel))) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论