git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4473 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-03-07 23:24:09 +00:00
parent e5251932fd
commit 13c9b4779a
3 changed files with 90 additions and 28 deletions
+4 -3
View File
@@ -787,9 +787,10 @@ static void set_local_sdp(private_object_t *tech_pvt, char *ip, uint32_t port, c
if (tech_pvt->te > 95) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
}
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/%d\n", tech_pvt->cng_pt, rate);
if (tech_pvt->cng_pt) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/%d\n", tech_pvt->cng_pt, rate);
tech_pvt->cng_pt = 0;
}
if (ptime) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
}
+7 -4
View File
@@ -53,6 +53,7 @@ struct timer_private {
switch_size_t reference;
switch_size_t start;
uint32_t roll;
uint32_t ready;
};
typedef struct timer_private timer_private_t;
@@ -83,6 +84,7 @@ static inline switch_status_t timer_init(switch_timer_t *timer)
timer->private_info = private_info;
private_info->start = private_info->reference = TIMER_MATRIX[timer->interval].tick;
private_info->roll = TIMER_MATRIX[timer->interval].roll;
private_info->ready = 1;
return SWITCH_STATUS_SUCCESS;
}
@@ -102,7 +104,7 @@ static inline switch_status_t timer_step(switch_timer_t *timer)
timer_private_t *private_info = timer->private_info;
uint64_t samples;
if (globals.RUNNING != 1) {
if (globals.RUNNING != 1 || private_info->ready == 0) {
return SWITCH_STATUS_FALSE;
}
@@ -127,7 +129,7 @@ static inline switch_status_t timer_next(switch_timer_t *timer)
timer_step(timer);
while (globals.RUNNING == 1 && TIMER_MATRIX[timer->interval].tick < private_info->reference) {
while (globals.RUNNING == 1 && private_info->ready && TIMER_MATRIX[timer->interval].tick < private_info->reference) {
check_roll();
switch_yield(1000);
}
@@ -146,7 +148,7 @@ static inline switch_status_t timer_check(switch_timer_t *timer)
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_size_t diff;
if (globals.RUNNING != 1) {
if (globals.RUNNING != 1 || !private_info->ready) {
return SWITCH_STATUS_SUCCESS;
}
@@ -170,13 +172,14 @@ static inline switch_status_t timer_check(switch_timer_t *timer)
static inline switch_status_t timer_destroy(switch_timer_t *timer)
{
timer_private_t *private_info = timer->private_info;
switch_mutex_lock(globals.mutex);
TIMER_MATRIX[timer->interval].count--;
if (TIMER_MATRIX[timer->interval].count == 0) {
TIMER_MATRIX[timer->interval].tick = 0;
}
switch_mutex_unlock(globals.mutex);
timer->private_info = NULL;
private_info->ready = 0;
return SWITCH_STATUS_SUCCESS;
}