From: Michael Jerris Date: Fri, 11 May 2007 16:40:20 +0000 (+0000) Subject: backport fix from iaxclient sf repo rev536 X-Git-Tag: v1.0-beta1~339 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98d4fd0b29a542928c525e238a135e951864f396;p=thirdparty%2Ffreeswitch.git backport fix from iaxclient sf repo rev536 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5149 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/libs/iax/src/iax.c b/libs/iax/src/iax.c index c24e916eaa..54a18515a8 100644 --- a/libs/iax/src/iax.c +++ b/libs/iax/src/iax.c @@ -788,9 +788,22 @@ static int speex_get_samples(unsigned char *data, int len) 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 @@ struct iax_event *iax_get_event(int blocking) 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);