From a8433a195670cb75fe6381c175f30e0c61e63b68 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Nov 2007 23:30:40 +0000 Subject: [PATCH] update git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6454 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/libteletone/src/libteletone_detect.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/libteletone/src/libteletone_detect.c b/libs/libteletone/src/libteletone_detect.c index b36feb3410..cd45597fa9 100644 --- a/libs/libteletone/src/libteletone_detect.c +++ b/libs/libteletone/src/libteletone_detect.c @@ -230,7 +230,7 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt, mt->energy += famp*famp; - for(x = 0; x < mt->tone_count; x++) { + for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { v1 = mt->gs[x].v2; mt->gs[x].v2 = mt->gs[x].v3; mt->gs[x].v3 = (float)(mt->gs[x].fac * mt->gs[x].v2 - v1 + famp); @@ -247,13 +247,13 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt, } eng_sum = 0; - for(x = 0; x < mt->tone_count; x++) { + for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { eng_all[x] = (float)(teletone_goertzel_result (&mt->gs[x])); eng_sum += eng_all[x]; } gtest = 0; - for(x = 0; x < mt->tone_count; x++) { + for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { gtest += teletone_goertzel_result (&mt->gs2[x]) < eng_all[x] ? 1 : 0; } @@ -281,7 +281,7 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt, } /* Reinitialise the detector for the next block */ - for(x = 0; x < mt->tone_count; x++) { + for(x = 0; x < TELETONE_MAX_TONES && x < mt->tone_count; x++) { goertzel_init (&mt->gs[x], &mt->tdd[x]); goertzel_init (&mt->gs2[x], &mt->tdd[x]); }