backport fix from iaxclient sf repo rev536
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5149 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
171af94f44
commit
98d4fd0b29
|
@ -788,9 +788,22 @@ static int speex_get_samples(unsigned char *data, int len)
|
||||||
return cnt;
|
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)
|
static int get_sample_cnt(struct iax_event *e)
|
||||||
{
|
{
|
||||||
int cnt = 0;
|
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) {
|
switch (e->subclass) {
|
||||||
case AST_FORMAT_SPEEX:
|
case AST_FORMAT_SPEEX:
|
||||||
cnt = speex_get_samples(e->data, e->datalen);
|
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;
|
now = time_in_ms - cur->rxcore;
|
||||||
if(now > (next = jb_next(cur->jb))) {
|
if(now > (next = jb_next(cur->jb))) {
|
||||||
/* FIXME don't hardcode interpolation frame length in jb_get */
|
ret = jb_get(cur->jb,&frame,now,get_interp_len(cur->voiceformat));
|
||||||
ret = jb_get(cur->jb,&frame,now,20);
|
|
||||||
switch(ret) {
|
switch(ret) {
|
||||||
case JB_OK:
|
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);
|
// 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);
|
||||||
|
|
Loading…
Reference in New Issue