From d1f147ffe8ec23d5aa9c3fe4a3b4dcf64f368245 Mon Sep 17 00:00:00 2001 From: MelwareDE Date: Mon, 8 May 2006 16:48:57 +0000 Subject: [PATCH] - don't use smoother in RTP mode and make sure not to send too may DATA_B3_REQs --- chan_capi.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/chan_capi.c b/chan_capi.c index 4621b0d..79fe4ed 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -1436,12 +1436,20 @@ static int capi_write(struct ast_channel *c, struct ast_frame *f) cc_mutex_unlock(&i->lock); return 0; } - if (((i->isdnstate & CAPI_ISDN_STATE_RTP) && (!(f->subclass & i->codec))) && - (f->subclass != capi_capability)) { - cc_log(LOG_ERROR, "dont know how to write subclass %s(%d)\n", - ast_getformatname(f->subclass), f->subclass); + if (i->isdnstate & CAPI_ISDN_STATE_RTP) { + if ((!(f->subclass & i->codec)) && + (f->subclass != capi_capability)) { + cc_log(LOG_ERROR, "dont know how to write subclass %s(%d)\n", + ast_getformatname(f->subclass), f->subclass); + cc_mutex_unlock(&i->lock); + return 0; + } + if (i->B3q < CAPI_MAX_B3_BLOCKS) { + ret = capi_write_rtp(c, f); + i->B3q++; + } cc_mutex_unlock(&i->lock); - return 0; + return ret; } if (ast_smoother_feed(i->smoother, f) != 0) { @@ -1453,10 +1461,6 @@ static int capi_write(struct ast_channel *c, struct ast_frame *f) for (fsmooth = ast_smoother_read(i->smoother); fsmooth != NULL; fsmooth = ast_smoother_read(i->smoother)) { - if ((i->isdnstate & CAPI_ISDN_STATE_RTP)) { - ret = capi_write_rtp(c, fsmooth); - continue; - } DATA_B3_REQ_HEADER(&CMSG, capi_ApplID, get_capi_MessageNumber(), 0); DATA_B3_REQ_NCCI(&CMSG) = i->NCCI; DATA_B3_REQ_DATALENGTH(&CMSG) = fsmooth->datalen; @@ -3701,6 +3705,9 @@ static void capi_handle_msg(_cmsg *CMSG) break; case CAPI_P_CONF(DATA_B3): wInfo = DATA_B3_CONF_INFO(CMSG); + if ((i) && (i->B3q > 0) && (i->isdnstate & CAPI_ISDN_STATE_RTP)) { + i->B3q--; + } break; case CAPI_P_CONF(DISCONNECT):