[asterisk-commits] russell: branch 1.6.0 r110304 - in /branches/1.6.0: ./ main/file.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 20 15:10:28 CDT 2008
Author: russell
Date: Thu Mar 20 15:10:27 2008
New Revision: 110304
URL: http://svn.digium.com/view/asterisk?view=rev&rev=110304
Log:
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)
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/main/file.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/main/file.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/file.c?view=diff&rev=110304&r1=110303&r2=110304
==============================================================================
--- branches/1.6.0/main/file.c (original)
+++ branches/1.6.0/main/file.c Thu Mar 20 15:10:27 2008
@@ -665,9 +665,17 @@
}
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);
More information about the asterisk-commits
mailing list