MT#56856 log duration only for end events

The "duration" is not valid for events which are not end events as
there's no previous event to derive a duration from.

Change-Id: I3f9dad536b168cce24d1a58c5bcf25e5cacfe7a8
pull/1657/head
Richard Fuchs 3 years ago
parent 875e74065e
commit 6b5f1f081c

@ -403,11 +403,12 @@ void dtmf_dsp_event(const struct dtmf_event *new_event, struct dtmf_event *cur_e
// we don't have a real fsin so just use the stream address // we don't have a real fsin so just use the stream address
struct packet_stream *ps = media->streams.head->data; struct packet_stream *ps = media->streams.head->data;
unsigned int duration = new_event->ts - cur_event.ts;
LOCK(&media->dtmf_lock); LOCK(&media->dtmf_lock);
if (end_event) { if (end_event) {
unsigned int duration = new_event->ts - cur_event.ts;
ilog(LOG_DEBUG, "DTMF DSP end event: event %i, volume %i, duration %u", ilog(LOG_DEBUG, "DTMF DSP end event: event %i, volume %i, duration %u",
cur_event.code, cur_event.volume, duration); cur_event.code, cur_event.volume, duration);
@ -415,8 +416,8 @@ void dtmf_dsp_event(const struct dtmf_event *new_event, struct dtmf_event *cur_e
duration, &ps->endpoint, clockrate, false, ts, injected); duration, &ps->endpoint, clockrate, false, ts, injected);
} }
else { else {
ilog(LOG_DEBUG, "DTMF DSP code event: event %i, volume %i, duration %u", ilog(LOG_DEBUG, "DTMF DSP code event: event %i, volume %i",
new_event->code, new_event->volume, duration); new_event->code, new_event->volume);
int code = dtmf_code_from_char(new_event->code); // for validation int code = dtmf_code_from_char(new_event->code); // for validation
if (code != -1) if (code != -1)
dtmf_code_event(media, (char) new_event->code, ts, clockrate, dtmf_code_event(media, (char) new_event->code, ts, clockrate,

Loading…
Cancel
Save