]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ftmod_isdn: Fix per-channel teletone buffer offset wraparound.
authorStefan Knoblich <stkn@openisdn.net>
Thu, 26 Jul 2012 07:06:08 +0000 (09:06 +0200)
committerStefan Knoblich <stkn@openisdn.net>
Thu, 26 Jul 2012 07:14:51 +0000 (09:14 +0200)
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 <stkn@openisdn.net>
libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c

index bd00789248d7ab7e42b11c943e97b892aa91f8c3..de53002b792a51d936068f2b5948e3bf93760057 100644 (file)
@@ -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);
                        }
                }