From f53f6211859135333245371ea76172d4627c4a6a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 30 Sep 2008 17:24:04 +0000 Subject: [PATCH] tweaks git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9761 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_rtp.c | 5 ++--- src/switch_time.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 807c3c7374..9382699208 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -760,7 +760,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool) { switch_rtp_t *rtp_session = NULL; - uint32_t ssrc = rand() & 0xffffffff; *new_rtp_session = NULL; @@ -792,7 +791,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session rtp_session->seq = (uint16_t) rand(); - rtp_session->ssrc = ssrc; + rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_timestamp(NULL)); rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc); rtp_session->send_msg.header.ts = 0; rtp_session->send_msg.header.m = 0; @@ -1247,7 +1246,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } if (rtp_session->timer.interval) { - sleep_mss = 1000;//rtp_session->timer.interval * 1000; + sleep_mss = rtp_session->timer.interval * 1000; } else { rtp_session->last_time = switch_time_now(); } diff --git a/src/switch_time.c b/src/switch_time.c index bec5c9556f..4f566e40f2 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -139,6 +139,15 @@ SWITCH_DECLARE(void) switch_time_sync(void) SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t) { +#if defined(HAVE_USLEEP) + usleep(t); +#elif defined(WIN32) + Sleep((DWORD) ((t) / 1000)); +#else + apr_sleep(t); +#endif + +#if 0 #if defined(HAVE_CLOCK_NANOSLEEP) && defined(SWITCH_USE_CLOCK_FUNCS) struct timespec ts; ts.tv_sec = t / APR_USEC_PER_SEC; @@ -153,7 +162,7 @@ SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t) #else apr_sleep(t); #endif - +#endif }