From: Stefan Knoblich Date: Thu, 26 Jul 2012 07:06:08 +0000 (+0200) Subject: ftmod_isdn: Fix per-channel teletone buffer offset wraparound. X-Git-Tag: v1.2.0~59 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ebc68fb51a76efc8574a4b6d92b05340e7c2c72;p=thirdparty%2Ffreeswitch.git ftmod_isdn: Fix per-channel teletone buffer offset wraparound. Do a "soft" wraparound with modulo, removes the ~0.5s tone glitch. (Multiply ts.rate (samples) by two to match the offset unit (bytes, 2 per sample).) Signed-off-by: Stefan Knoblich --- diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index bd00789248..de53002b79 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1964,9 +1964,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) data->offset += rlen; } - if (data->offset >= ts.rate) { - data->offset = 0; - } + data->offset %= (ts.rate << 1); } }