diff options
author | jdixon <jdixon@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-29 04:18:36 +0000 |
---|---|---|
committer | jdixon <jdixon@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-29 04:18:36 +0000 |
commit | 2061f7c67b27e4a1382dee603b59ba236f8202ea (patch) | |
tree | a84e4100c6244050a6aa3538e5784ef494a4687e /main/jitterbuf.c | |
parent | b2e0845b8da4d9bb620b037d342a93a8ccca3d91 (diff) |
Fixed problem with jitterbuf, whereas it would not complain about, and
would allow itself to be overfilled (per the max_jitterbuf parameter). Now
it rejects any data over and above that size, and complains about it.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@52494 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/jitterbuf.c')
-rw-r--r-- | main/jitterbuf.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/main/jitterbuf.c b/main/jitterbuf.c index 05e29a4a4..f87e273b6 100644 --- a/main/jitterbuf.c +++ b/main/jitterbuf.c @@ -512,17 +512,30 @@ static void jb_dbgqueue(jitterbuf *jb) enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, long ts, long now) { + long numts; + jb_dbg2("jb_put(%x,%x,%ld,%ld,%ld)\n", jb, data, ms, ts, now); jb->info.frames_in++; + if (jb->frames && jb->dropem) return(JB_DROP); + jb->dropem = 0; + if (type == JB_TYPE_VOICE) { /* presently, I'm only adding VOICE frames to history and drift calculations; mostly because with the * IAX integrations, I'm sending retransmitted control frames with their awkward timestamps through */ if (history_put(jb,ts,now,ms)) return JB_DROP; } - + numts = 0; + if (jb->frames) { + numts = jb->frames->prev->ts - jb->frames->ts; + } + if (numts >= jb->info.conf.max_jitterbuf) { + ast_log(LOG_NOTICE,"Attempting to exceed Jitterbuf max %ld timeslots\n",jb->info.conf.max_jitterbuf); + jb->dropem = 1; + return JB_DROP; + } /* if put into head of queue, caller needs to reschedule */ if (queue_put(jb,data,type,ms,ts)) { return JB_SCHED; |