diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-22 21:14:55 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-04-22 21:14:55 +0000 |
commit | 9935bee8cf864b5a57787f8fd72d150ef89ce68b (patch) | |
tree | 9b131feb9104cf0ca54f6bbc52640ee0f0c1798e /main/file.c | |
parent | 0f572d416bc6cd1ed82cb9493cd1d2daff48667f (diff) |
I thought I was going to be able to leave 1.4 alone, but that was not the case.
I ran into some problems with G.722 in 1.4, so I have merged in all of the fixes
in this area that I have made in trunk/1.6.0, and things are happy again.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@114550 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/file.c')
-rw-r--r-- | main/file.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/main/file.c b/main/file.c index c44941b2b..340eb4ee3 100644 --- a/main/file.c +++ b/main/file.c @@ -680,11 +680,21 @@ static enum fsread_res ast_readaudio_callback(struct ast_filestream *s) } if (whennext != s->lasttimeout) { #ifdef HAVE_ZAPTEL - if (s->owner->timingfd > -1) - ast_settimeout(s->owner, whennext, ast_fsread_audio, s); - else + if (s->owner->timingfd > -1) { + int zap_timer_samples = whennext; + int rate; + /* whennext is in samples, but zaptel timers operate in 8 kHz samples. */ + if ((rate = ast_format_rate(s->fmt->format)) != 8000) { + float factor; + factor = ((float) rate) / ((float) 8000.0); + zap_timer_samples = (int) ( ((float) zap_timer_samples) / factor ); + } + ast_settimeout(s->owner, zap_timer_samples, ast_fsread_audio, s); + } else #endif - s->owner->streamid = ast_sched_add(s->owner->sched, whennext/8, ast_fsread_audio, s); + s->owner->streamid = ast_sched_add(s->owner->sched, + whennext / (ast_format_rate(s->fmt->format) / 1000), + ast_fsread_audio, s); s->lasttimeout = whennext; return FSREAD_SUCCESS_NOSCHED; } @@ -728,7 +738,8 @@ static enum fsread_res ast_readvideo_callback(struct ast_filestream *s) } if (whennext != s->lasttimeout) { - s->owner->vstreamid = ast_sched_add(s->owner->sched, whennext / 8, + s->owner->vstreamid = ast_sched_add(s->owner->sched, + whennext / (ast_format_rate(s->fmt->format) / 1000), ast_fsread_video, s); s->lasttimeout = whennext; return FSREAD_SUCCESS_NOSCHED; |