[asterisk-commits] mnicholson: branch 1.6.1 r174590 - in /branches/1.6.1: ./ main/jitterbuf.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 10 12:18:23 CST 2009


Author: mnicholson
Date: Tue Feb 10 12:18:23 2009
New Revision: 174590

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=174590
Log:
Merged revisions 174584 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r174584 | mnicholson | 2009-02-10 12:16:31 -0600 (Tue, 10 Feb 2009) | 25 lines
  
  Merged revisions 174583 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r174583 | mnicholson | 2009-02-10 11:52:42 -0600 (Tue, 10 Feb 2009) | 18 lines
    
    Improve behavior of jitterbuffer when maxjitterbuffer is set.
    
    This change improves the way the jitterbuffer handles maxjitterbuffer and
    dramatically reduces the number of frames dropped when maxjitterbuffer is
    exceeded.  In the previous jitterbuffer, when maxjitterbuffer was exceeded, all
    new frames were dropped until the jitterbuffer is empty.  This change modifies
    the code to only drop frames until maxjitterbuffer is no longer exceeded.
    
    Also, previously when maxjitterbuffer was exceeded, dropped frames were not
    tracked causing stats for dropped frames to be incorrect, this change also
    addresses that problem.
    
    (closes issue #14044)
    Patches:
          bug14044-1.diff uploaded by mnicholson (license 96)
    Tested by: mnicholson
    Review: http://reviewboard.digium.com/r/144/
  ........
................

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/main/jitterbuf.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/main/jitterbuf.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.1/main/jitterbuf.c?view=diff&rev=174590&r1=174589&r2=174590
==============================================================================
--- branches/1.6.1/main/jitterbuf.c (original)
+++ branches/1.6.1/main/jitterbuf.c Tue Feb 10 12:18:23 2009
@@ -510,27 +510,33 @@
 
 	jb_dbg2("jb_put(%x,%x,%ld,%ld,%ld)\n", jb, data, ms, ts, now);
 
-	jb->info.frames_in++;
-
-	if (jb->frames && jb->dropem) 
+	numts = 0;
+	if (jb->frames)
+		numts = jb->frames->prev->ts - jb->frames->ts;
+
+	if (numts >= jb->info.conf.max_jitterbuf) {
+		if (!jb->dropem) {
+			ast_debug(1, "Attempting to exceed Jitterbuf max %ld timeslots\n",
+				jb->info.conf.max_jitterbuf);
+			jb->dropem = 1;
+		}
+		jb->info.frames_dropped++;
 		return JB_DROP;
-	jb->dropem = 0;
+	} else {
+		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))
+		if (history_put(jb,ts,now,ms)) {
+			jb->info.frames_dropped++;
 			return JB_DROP;
-	}
-	numts = 0;
-	if (jb->frames)
-		numts = jb->frames->prev->ts - jb->frames->ts;
-	if (numts >= jb->info.conf.max_jitterbuf) {
-		ast_debug(1, "Attempting to exceed Jitterbuf max %ld timeslots\n",
-			jb->info.conf.max_jitterbuf);
-		jb->dropem = 1;
-		return JB_DROP;
-	}
+		}
+	}
+
+	jb->info.frames_in++;
+
 	/* 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