[asterisk-commits] branch oej/jitterbuffer r11379 - /team/oej/jitterbuffer/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Feb 28 09:45:05 MST 2006


Author: oej
Date: Tue Feb 28 10:45:03 2006
New Revision: 11379

URL: http://svn.digium.com/view/asterisk?rev=11379&view=rev
Log:
Bug fixes from RoyK/slav

Modified:
    team/oej/jitterbuffer/abstract_jb.c
    team/oej/jitterbuffer/scx_jitterbuf.c

Modified: team/oej/jitterbuffer/abstract_jb.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/abstract_jb.c?rev=11379&r1=11378&r2=11379&view=diff
==============================================================================
--- team/oej/jitterbuffer/abstract_jb.c (original)
+++ team/oej/jitterbuffer/abstract_jb.c Tue Feb 28 10:45:03 2006
@@ -341,13 +341,22 @@
 		return -1;
 	}
 	
-	if(!f->has_timing_info || f->len < 2)
-	{
-		/* TODO: Shouldn't we disable the jb here? Or we can produce timestamp and seqno? */
+	/* We consider an enabled jitterbuffer should receive frames with valid timing info. */
+	if(!f->has_timing_info || f->len < 2 || f->ts < 0)
+	{
+		ast_log(LOG_WARNING, "Recieved frame with invalid timing info: "
+			"has_timing_info=%d, len=%ld, ts=%ld\n", f->has_timing_info, f->len, f->ts);
 		return -1;
 	}
 	
-	frr = ast_frisolate(f);
+	if(f->mallocd & AST_MALLOCD_HDR)
+	{
+		frr = ast_frdup(f);
+	}
+	else
+	{
+		frr = ast_frisolate(f);
+	}
 	if(frr == NULL)
 	{
 		ast_log(LOG_ERROR, "Failed to isolate frame for the jitterbuffer on channel '%s'\n", chan->name);

Modified: team/oej/jitterbuffer/scx_jitterbuf.c
URL: http://svn.digium.com/view/asterisk/team/oej/jitterbuffer/scx_jitterbuf.c?rev=11379&r1=11378&r2=11379&view=diff
==============================================================================
--- team/oej/jitterbuffer/scx_jitterbuf.c (original)
+++ team/oej/jitterbuffer/scx_jitterbuf.c Tue Feb 28 10:45:03 2006
@@ -305,8 +305,6 @@
 
 int scx_jb_get(struct scx_jb *jb, struct scx_jb_frame *frame, long now, long interpl)
 {
-	long halflen;
-	
 	assert(now >= 0);
 	assert(interpl >= 2);
 	
@@ -326,10 +324,8 @@
 		return SCX_JB_INTERP;
 	}
 	
-	halflen = (long) ((double) jb->frames->ms / 2.0);
-	
 	/* Isn't it too late for the first frame available in the jb? */
-	if(now > jb->frames->delivery + halflen)
+	if(now > jb->frames->delivery + jb->frames->ms)
 	{
 		/* yes - should drop this frame and update next to point the next frame (get_jb_head() does it) */
 		get_jb_head(jb, frame);
@@ -338,7 +334,7 @@
 	}
 	
 	/* isn't it too early to play the first frame available? */
-	if(now < jb->frames->delivery  - halflen)
+	if(now < jb->frames->delivery)
 	{
 		/* yes - should interpolate one frame */
 		/* update next */



More information about the asterisk-commits mailing list