From 7362b108db3e282fb8684d86dde56cd48e03610f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 16 Nov 2005 15:36:18 +0000 Subject: [PATCH] git-svn-id: http://svn.freeswitch.org/svn/local/src/freeswitch@20 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- platform/vsnet/Freeswitch.sln | 16 ++++++++++ src/mod/mod_bridgecall/mod_bridgecall.c | 2 +- src/mod/mod_dialplan_demo/mod_dialplan_demo.c | 4 +-- src/mod/mod_exosip/mod_exosip.c | 29 +++++++++---------- src/mod/mod_softtimer/mod_softtimer.c | 4 +-- src/switch_core.c | 14 +++++---- 6 files changed, 43 insertions(+), 26 deletions(-) diff --git a/platform/vsnet/Freeswitch.sln b/platform/vsnet/Freeswitch.sln index 87f38b4cc5..1915492312 100644 --- a/platform/vsnet/Freeswitch.sln +++ b/platform/vsnet/Freeswitch.sln @@ -72,6 +72,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "osipparser2", "..\..\..\osi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eXosip", "..\..\..\eXosip\platform\vsnet\eXosip.vcproj", "{4EA67539-9EE9-4065-BD39-87E517FD8262}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ccrtp4c", "..\..\..\ccrtp4c\w32\msvc\ccrtp4c.vcproj", "{9ACCBFFD-390A-42F9-BD50-FF84A17A093A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug IPv6 MSR|Win32 = Debug IPv6 MSR|Win32 @@ -279,6 +281,20 @@ Global {4EA67539-9EE9-4065-BD39-87E517FD8262}.Release IPv6 XP|Win32.Build.0 = Release|Win32 {4EA67539-9EE9-4065-BD39-87E517FD8262}.Release|Win32.ActiveCfg = Release|Win32 {4EA67539-9EE9-4065-BD39-87E517FD8262}.Release|Win32.Build.0 = Release|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug IPv6 MSR|Win32.ActiveCfg = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug IPv6 MSR|Win32.Build.0 = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug IPv6 Musica|Win32.ActiveCfg = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug IPv6 Musica|Win32.Build.0 = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug IPv6 Win2000|Win32.ActiveCfg = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug IPv6 Win2000|Win32.Build.0 = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug|Win32.ActiveCfg = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Debug|Win32.Build.0 = Debug|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Release IPv6 Win2000|Win32.ActiveCfg = Release|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Release IPv6 Win2000|Win32.Build.0 = Release|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Release IPv6 XP|Win32.ActiveCfg = Release|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Release IPv6 XP|Win32.Build.0 = Release|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Release|Win32.ActiveCfg = Release|Win32 + {9ACCBFFD-390A-42F9-BD50-FF84A17A093A}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/mod/mod_bridgecall/mod_bridgecall.c b/src/mod/mod_bridgecall/mod_bridgecall.c index e1c14c342b..c2d3ebe4f6 100644 --- a/src/mod/mod_bridgecall/mod_bridgecall.c +++ b/src/mod/mod_bridgecall/mod_bridgecall.c @@ -79,7 +79,7 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj) switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Bad Frame....Bubye!\n"); data->running = -1; } - switch_yield(100); + //switch_yield(100); } switch_channel_hangup(chan_b); diff --git a/src/mod/mod_dialplan_demo/mod_dialplan_demo.c b/src/mod/mod_dialplan_demo/mod_dialplan_demo.c index 08d73b582b..2cd50132e0 100644 --- a/src/mod/mod_dialplan_demo/mod_dialplan_demo.c +++ b/src/mod/mod_dialplan_demo/mod_dialplan_demo.c @@ -59,7 +59,7 @@ switch_caller_extension *demo_dialplan_hunt(switch_core_session *session) switch_channel_hangup(channel); return NULL; } - + while (switch_config_next_pair(&cfg, &var, &val)) { if (!strcasecmp(cfg.category, "extensions")) { if (!strcmp(var, caller_profile->destination_number) && val) { @@ -67,7 +67,7 @@ switch_caller_extension *demo_dialplan_hunt(switch_core_session *session) memset(app, 0, sizeof(app)); strncpy(app, val, sizeof(app)); - + if ((data = strchr(app, ' '))) { *data = '\0'; data++; diff --git a/src/mod/mod_exosip/mod_exosip.c b/src/mod/mod_exosip/mod_exosip.c index 695ff8ec7a..ac3526d24b 100644 --- a/src/mod/mod_exosip/mod_exosip.c +++ b/src/mod/mod_exosip/mod_exosip.c @@ -470,12 +470,13 @@ static void activate_rtp(struct private_object *tech_pvt) tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, tech_pvt->read_codec.codec_interface->ianacode, - ms , - ms * 20); + ms, + ms * 15); if (tech_pvt->rtp_session) { tech_pvt->ssrc = ccrtp4c_get_ssrc(tech_pvt->rtp_session); ccrtp4c_start(tech_pvt->rtp_session); + tech_pvt->timestamp_recv = tech_pvt->timestamp_send = ccrtp4c_current_timestamp(tech_pvt->rtp_session); switch_set_flag(tech_pvt, TFLAG_RTP); } else { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Oh oh?\n"); @@ -522,7 +523,7 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram size_t bytes = 0, samples = 0, frames=0, ms=0; switch_channel *channel = NULL; switch_time_t reference, now; - int mult = 2; + int mult = 1; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -548,7 +549,7 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram assert(tech_pvt->rtp_session != NULL); tech_pvt->read_frame.datalen = 0; - + reference = switch_time_now(); reference += (ms * mult); while(!switch_test_flag(tech_pvt, TFLAG_BYE) && switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) { @@ -567,12 +568,12 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram now = switch_time_now(); if (now >= reference) { - printf("TO\n"); - //memset(tech_pvt->read_buf, 0, bytes *2); - //tech_pvt->timestamp_recv += (samples * mult); - //reference += (ms * mult); - //tech_pvt->read_frame.datalen = bytes *2; - //break; + //printf("TO\n"); + memset(tech_pvt->read_buf, 0, bytes * mult); + tech_pvt->timestamp_recv += (samples * mult); + reference += (ms * mult); + tech_pvt->read_frame.datalen = bytes *2; + break; } switch_yield(100); @@ -643,12 +644,10 @@ static switch_status exosip_write_frame(switch_core_session *session, switch_fra //printf("%s %s->%s send %d bytes %d samples in %d frames taking up %d ms ts=%d\n", switch_channel_get_name(channel), tech_pvt->local_sdp_audio_ip, tech_pvt->remote_sdp_audio_ip, frame->datalen, samples, frames, ms, tech_pvt->timestamp_send); - - tech_pvt->timestamp_send += (int)samples; + + ccrtp4c_write(tech_pvt->rtp_session, frame->data, frame->datalen, &tech_pvt->timestamp_send); - - - + tech_pvt->timestamp_send += (int)samples; switch_clear_flag(tech_pvt, TFLAG_WRITING); //switch_mutex_unlock(tech_pvt->rtp_lock); diff --git a/src/mod/mod_softtimer/mod_softtimer.c b/src/mod/mod_softtimer/mod_softtimer.c index 8608dac047..d63ab444a2 100644 --- a/src/mod/mod_softtimer/mod_softtimer.c +++ b/src/mod/mod_softtimer/mod_softtimer.c @@ -35,7 +35,7 @@ static const char modname[] = "mod_softtimer"; #ifdef WIN32 -#define WINTIMER +//#define WINTIMER #endif struct timer_private { @@ -82,7 +82,7 @@ static switch_status soft_timer_next(switch_timer *timer) private->reference += timer->interval * 1000; while (switch_time_now() < private->reference) { - switch_yield(100); + switch_yield(1000); } #endif diff --git a/src/switch_core.c b/src/switch_core.c index 2c733f6faf..585fef5c1f 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1268,10 +1268,12 @@ SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash *hash, char *key) SWITCH_DECLARE(void) switch_core_launch_module_thread(switch_thread_start_t func, void *obj) { switch_thread *thread; + apr_threadattr_t *thd_attr;; + apr_threadattr_create(&thd_attr, runtime.memory_pool); + apr_threadattr_detach_set(thd_attr, 1); - /* The 2nd needs to be a thread attr soon */ switch_thread_create(&thread, - NULL, + thd_attr, func, obj, runtime.memory_pool @@ -1305,8 +1307,6 @@ SWITCH_DECLARE(void) switch_core_session_thread_launch(switch_core_session *sess { switch_thread *thread; apr_threadattr_t *thd_attr;; - - /* The 2nd needs to be a thread attr soon */ apr_threadattr_create(&thd_attr, session->pool); apr_threadattr_detach_set(thd_attr, 1); @@ -1324,10 +1324,12 @@ SWITCH_DECLARE(void) switch_core_session_thread_launch(switch_core_session *sess SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session *session, switch_thread_start_t func, void *obj) { switch_thread *thread; + apr_threadattr_t *thd_attr;; + apr_threadattr_create(&thd_attr, session->pool); + apr_threadattr_detach_set(thd_attr, 1); - /* The 2nd needs to be a thread attr soon */ switch_thread_create(&thread, - NULL, + thd_attr, func, obj, session->pool