aboutsummaryrefslogtreecommitdiffstats
path: root/main/dsp.c
diff options
context:
space:
mode:
authorlmadsen <lmadsen@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-07 15:34:16 +0000
committerlmadsen <lmadsen@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-07 15:34:16 +0000
commitfd2ae416146a71c26db0077bf1e8ad1ef5e4fe00 (patch)
tree8f121510451022d75fe6313f31a04a2b662b3ceb /main/dsp.c
parent981ddca2f0f8c85a17d9e08dbefaca8aabe0f159 (diff)
Update ChangeLog and merge revision 268457 from the 1.6.2 branch.v1.6.2.9-rc2
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.2.9-rc2@268577 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/dsp.c')
-rw-r--r--main/dsp.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/main/dsp.c b/main/dsp.c
index 9bb926a82..65778890f 100644
--- a/main/dsp.c
+++ b/main/dsp.c
@@ -273,11 +273,8 @@ typedef struct
typedef struct
{
char digits[MAX_DTMF_DIGITS + 1];
- int current_digits;
- /* Store lengths separately, because next digit may begin before last has
- * ended (because hits_to_begin may be less than misses_to_end). */
int digitlen[MAX_DTMF_DIGITS + 1];
- int current_len;
+ int current_digits;
int detected_digits;
int lost_digits;
@@ -515,7 +512,6 @@ static void ast_mf_detect_init (mf_detect_state_t *s)
static void ast_digit_detect_init(digit_detect_state_t *s, int mf)
{
s->current_digits = 0;
- s->current_len = 0;
s->detected_digits = 0;
s->lost_digits = 0;
s->digits[0] = '\0';
@@ -739,8 +735,8 @@ static int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp
}
} else {
s->td.dtmf.misses = 0;
- /* Current hit was same as last, so increment digit duration */
- s->digitlen[s->current_len] += DTMF_GSIZE;
+ /* Current hit was same as last, so increment digit duration (of last digit) */
+ s->digitlen[s->current_digits - 1] += DTMF_GSIZE;
}
}
@@ -1423,9 +1419,8 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
event_len = dsp->digit_state.digitlen[0] * 1000 / SAMPLE_RATE;
}
memmove(&dsp->digit_state.digits[0], &dsp->digit_state.digits[1], dsp->digit_state.current_digits);
+ memmove(&dsp->digit_state.digitlen[0], &dsp->digit_state.digitlen[1], dsp->digit_state.current_digits * sizeof(dsp->digit_state.digitlen[0]));
dsp->digit_state.current_digits--;
- memmove(&dsp->digit_state.digitlen[0], &dsp->digit_state.digitlen[1], dsp->digit_state.current_len * sizeof(dsp->digit_state.digitlen[0]));
- dsp->digit_state.current_len--;
dsp->dtmf_began = 0;
if (dsp->features & DSP_FEATURE_BUSY_DETECT) {