[asterisk-commits] russell: branch 1.4 r52506 - in /branches/1.4: include/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jan 29 09:54:28 MST 2007


Author: russell
Date: Mon Jan 29 10:54:27 2007
New Revision: 52506

URL: http://svn.digium.com/view/asterisk?view=rev&rev=52506
Log:
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:
    branches/1.4/include/jitterbuf.h
    branches/1.4/main/jitterbuf.c

Modified: branches/1.4/include/jitterbuf.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/jitterbuf.h?view=diff&rev=52506&r1=52505&r2=52506
==============================================================================
--- branches/1.4/include/jitterbuf.h (original)
+++ branches/1.4/include/jitterbuf.h Mon Jan 29 10:54:27 2007
@@ -103,8 +103,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? */
-	int  dropem;				/* flag to indicate dropping frames (overload) */
-
+	unsigned int dropem:1;                  /* flag to indicate dropping frames (overload) */
 
 	jb_frame *frames; 		/* queued frames */
 	jb_frame *free; 		/* free frames (avoid malloc?) */

Modified: branches/1.4/main/jitterbuf.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/jitterbuf.c?view=diff&rev=52506&r1=52505&r2=52506
==============================================================================
--- branches/1.4/main/jitterbuf.c (original)
+++ branches/1.4/main/jitterbuf.c Mon Jan 29 10:54:27 2007
@@ -518,8 +518,9 @@
 
 	jb->info.frames_in++;
 
-        if (jb->frames && jb->dropem) return(JB_DROP);
-        jb->dropem = 0;
+	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
@@ -527,15 +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_NOTICE,"Attempting to exceed Jitterbuf max %ld timeslots\n",jb->info.conf.max_jitterbuf);
-                jb->dropem = 1;
-                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