[Freeswitch-svn] [commit] r5149 - freeswitch/trunk/libs/iax/src

Freeswitch SVN mikej at freeswitch.org
Fri May 11 12:40:21 EDT 2007


Author: mikej
Date: Fri May 11 12:40:20 2007
New Revision: 5149

Modified:
   freeswitch/trunk/libs/iax/src/iax.c

Log:
backport fix from iaxclient sf repo rev536

Modified: freeswitch/trunk/libs/iax/src/iax.c
==============================================================================
--- freeswitch/trunk/libs/iax/src/iax.c	(original)
+++ freeswitch/trunk/libs/iax/src/iax.c	Fri May 11 12:40:20 2007
@@ -788,9 +788,22 @@
 	return cnt;
 }
 
+static inline int get_interp_len(int format)
+{
+	return (format == AST_FORMAT_ILBC) ? 30 : 20;
+}
+
 static int get_sample_cnt(struct iax_event *e)
 {
 	int cnt = 0;
+
+	/*
+	 * In the case of zero length frames, do not return a cnt of 0
+	 */
+	if ( e->datalen == 0 ) {
+		return get_interp_len( e->subclass ) * 8;
+	}
+
 	switch (e->subclass) {
 	  case AST_FORMAT_SPEEX:
 	    cnt = speex_get_samples(e->data, e->datalen);
@@ -3143,8 +3156,7 @@
 
 			now = time_in_ms - cur->rxcore;
 			if(now > (next = jb_next(cur->jb))) {
-				/* FIXME don't hardcode interpolation frame length in jb_get */
-				ret = jb_get(cur->jb,&frame,now,20);
+				ret = jb_get(cur->jb,&frame,now,get_interp_len(cur->voiceformat));
 				switch(ret) {
 				case JB_OK:
 					//			    if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);



More information about the Freeswitch-svn mailing list