fix race in codec failure condition, then fix bug in sdp parsing (likely a regression from recent codec changes) to never have the problem in the first place so you are double-protected

This commit is contained in:
Anthony Minessale committed 2010-10-27 16:37:35 -05:00
1 parent 3d547b1c64
commit 19325c4369
2 files changed
+26 -3

No files matched your search

+18
View File
@@ -124,6 +124,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
switch_mutex_lock(session->codec_read_mutex);
if (!switch_core_codec_ready(session->read_codec)) {
switch_mutex_unlock(session->codec_read_mutex);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
*frame = &runtime.dummy_cng_frame;
return SWITCH_STATUS_FALSE;
}
switch_mutex_lock(session->read_codec->mutex);
top:
@@ -181,6 +190,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
switch_mutex_lock(session->codec_read_mutex);
if (!switch_core_codec_ready(session->read_codec)) {
switch_mutex_unlock(session->codec_read_mutex);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
*frame = &runtime.dummy_cng_frame;
return SWITCH_STATUS_FALSE;
}
switch_mutex_lock(session->read_codec->mutex);
if (!switch_core_codec_ready(session->read_codec)) {
*frame = NULL;