diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-20 20:10:27 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-03-20 20:10:27 +0000 |
commit | d4e3d5cab3740eb5997e7ca0a33d383ee59bede7 (patch) | |
tree | 9ed15f1e6ad263d32e296616bcc68234f2ad34e0 /main | |
parent | fd8043527de94ad50bca4ac176eb946064adb907 (diff) |
Merged revisions 110303 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r110303 | russell | 2008-03-20 15:08:26 -0500 (Thu, 20 Mar 2008) | 8 lines
Fix a bug when using zaptel timing for playing back files that have a sample rate
other than 8 kHz. The issue here is that format modules give a "whennext" sample
value, which is used to calculate when to set a timer for to retrieve the next
frame. However, the zaptel timer operates on 8 kHz samples, so this must be taken
into account.
(another part of issue #12164, reported by milazzo and jsmith, patch by me)
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@110304 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/file.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/main/file.c b/main/file.c index 1bec4fca4..73387a2ff 100644 --- a/main/file.c +++ b/main/file.c @@ -665,9 +665,17 @@ 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 / (ast_format_rate(s->fmt->format) / 1000), ast_fsread_audio, s); |