a few perf tweaks

This commit is contained in:
root 2012-04-04 17:20:35 -05:00
parent df8d2f1ecd
commit 277c1141c4
5 changed files with 22 additions and 13 deletions

View File

@ -214,7 +214,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_get(_In_ switch_xml_t xml,...);
///\param prn_header add <?xml version..> header too
///\return the xml text string
SWITCH_DECLARE(char *) switch_xml_toxml(_In_ switch_xml_t xml, _In_ switch_bool_t prn_header);
SWITCH_DECLARE(char *) switch_xml_toxml_nolock(switch_xml_t xml, _In_ switch_bool_t prn_header);
///\brief Converts an switch_xml structure back to xml using the buffer passed in the parameters.
///\param xml the xml node
///\param buf buffer to use

View File

@ -5971,7 +5971,7 @@ void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *sess
}
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE);
xml_cdr_text = switch_xml_toxml_nolock(cdr, SWITCH_FALSE);
switch_xml_free(cdr);
}

View File

@ -1868,12 +1868,11 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
switch_channel_clear_flag(channel, CF_TAGGED);
switch_mutex_lock(channel->state_mutex);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_DEBUG, "(%s) Running State Change %s\n",
channel->name, state_names[state]);
switch_mutex_lock(channel->state_mutex);
channel->running_state = state;
if (state == CS_ROUTING || state == CS_HANGUP) {

View File

@ -41,7 +41,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
switch_io_event_hook_video_write_frame_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
if (switch_channel_down_nosig(session->channel)) {
if (switch_channel_down(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -65,7 +65,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
switch_assert(session != NULL);
if (switch_channel_down_nosig(session->channel)) {
if (switch_channel_down(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -153,7 +153,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
}
}
if (switch_channel_down_nosig(session->channel) || !switch_core_codec_ready(session->read_codec)) {
if (switch_channel_down(session->channel) || !switch_core_codec_ready(session->read_codec)) {
*frame = NULL;
status = SWITCH_STATUS_FALSE;
goto even_more_done;
@ -1114,7 +1114,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
while (switch_buffer_inuse(session->raw_write_buffer) >= session->write_impl.decoded_bytes_per_packet) {
int rate;
if (switch_channel_down_nosig(session->channel) || !session->raw_write_buffer) {
if (switch_channel_down(session->channel) || !session->raw_write_buffer) {
goto error;
}
if ((session->raw_write_frame.datalen = (uint32_t)
@ -1296,7 +1296,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio
switch_dtmf_t new_dtmf;
int fed = 0;
if (switch_channel_down_nosig(session->channel)) {
if (switch_channel_down(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -1339,7 +1339,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
switch_status_t status = SWITCH_STATUS_FALSE;
switch_dtmf_t new_dtmf;
if (switch_channel_down_nosig(session->channel)) {
if (switch_channel_down(session->channel)) {
return SWITCH_STATUS_FALSE;
}
@ -1418,7 +1418,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core
dtmf.flags = 0;
}
if (switch_channel_down_nosig(session->channel)) {
if (switch_channel_down(session->channel)) {
return SWITCH_STATUS_FALSE;
}

View File

@ -2451,12 +2451,22 @@ static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len,
}
}
SWITCH_DECLARE(char *) switch_xml_toxml_nolock(switch_xml_t xml, switch_bool_t prn_header)
{
char *s = (char *) malloc(SWITCH_XML_BUFSIZE);
switch_assert(s);
return switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header);
}
SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_header)
{
char *r, *s;
switch_mutex_lock(XML_GEN_LOCK);
s = (char *) malloc(SWITCH_XML_BUFSIZE);
switch_assert(s);
switch_mutex_lock(XML_GEN_LOCK);
r = switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header);
switch_mutex_unlock(XML_GEN_LOCK);
return r;