[asterisk-commits] russell: trunk r52522 - in /trunk: ./ include/jitterbuf.h main/jitterbuf.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jan 29 10:03:32 MST 2007


Author: russell
Date: Mon Jan 29 11:03:31 2007
New Revision: 52522

URL: http://svn.digium.com/view/asterisk?view=rev&rev=52522
Log:
Merged revisions 52494,52506 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r52494 | jdixon | 2007-01-28 22:18:36 -0600 (Sun, 28 Jan 2007) | 4 lines

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.

........
r52506 | russell | 2007-01-29 10:54:27 -0600 (Mon, 29 Jan 2007) | 5 lines

Clean up a few things in the last commit to the adaptive jitterbuffer code.
 - Specifically indicate to the compiler that the "dropem" variable only
   needs one but.
 - Change formatting to conform to coding guidelines.

........

Modified:
    trunk/   (props changed)
    trunk/include/jitterbuf.h
    trunk/main/jitterbuf.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/jitterbuf.h
URL: http://svn.digium.com/view/asterisk/trunk/include/jitterbuf.h?view=diff&rev=52522&r1=52521&r2=52522
==============================================================================
--- trunk/include/jitterbuf.h (original)
+++ trunk/include/jitterbuf.h Mon Jan 29 11:03:31 2007
@@ -104,7 +104,7 @@
 	long hist_maxbuf[JB_HISTORY_MAXBUF_SZ];	/* a sorted buffer of the max delays (highest first) */
 	long hist_minbuf[JB_HISTORY_MAXBUF_SZ];	/* a sorted buffer of the min delays (lowest first) */
 	int  hist_maxbuf_valid;			/* are the "maxbuf"/minbuf valid? */
-
+	unsigned int dropem:1;                  /* flag to indicate dropping frames (overload) */
 
 	jb_frame *frames; 		/* queued frames */
 	jb_frame *free; 		/* free frames (avoid malloc?) */

Modified: trunk/main/jitterbuf.c
URL: http://svn.digium.com/view/asterisk/trunk/main/jitterbuf.c?view=diff&rev=52522&r1=52521&r2=52522
==============================================================================
--- trunk/main/jitterbuf.c (original)
+++ trunk/main/jitterbuf.c Mon Jan 29 11:03:31 2007
@@ -512,9 +512,15 @@
 
 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
@@ -522,7 +528,15 @@
 		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_DEBUG, "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;



More information about the asterisk-commits mailing list