From bdb10226772a4450a3cd9a7330a07ba56d1b6a7c Mon Sep 17 00:00:00 2001 From: Tom Briden Date: Tue, 12 Mar 2024 12:11:30 +0000 Subject: [PATCH] MT#55283 codec_last_dtmf_event: return ts of dtmf_state if handler queue is empty this function is used to determine if a pause is needed on a new injected DTMF's start ts to ensure a gap between the events. However, if an inject request comes in after the end of the previous event but before it would have been offset due to pause, no pause is added This change returns the ts value from dtmf_state if the queue is empty as that will always be the ts of the last DTMF transmitted Change-Id: I4f3cf5115d1a8e26c0ca1bc9570c46e29391e0d0 --- daemon/codec.c | 2 +- t/auto-daemon-tests.pl | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index 520140703..66f155ab2 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -2666,7 +2666,7 @@ void codec_add_dtmf_event(struct codec_ssrc_handler *ch, int code, int level, ui uint64_t codec_last_dtmf_event(struct codec_ssrc_handler *ch) { struct dtmf_event *ev = t_queue_peek_tail(&ch->dtmf_events); if (!ev) - return 0; + ev = &ch->dtmf_state; return ev->ts; } diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index c9abd6884..90eb9ed04 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -1787,25 +1787,27 @@ $resp = rtpe_req('play DTMF', 'inject DTMF towards B over received DTMF', { 'from-tag' => ft(), code => '1', volume => 12, duration => 100 }); snd($sock_a, $port_b, rtp(101, 1022, 6040, 0x1234, "\x03\x26\x01\x40")); -rcv($sock_b, $port_a, rtpm(101 | 0x80, 1024, 6200, 0x1234, "\x01\x0c\x00\xa0")); +rcv_no($sock_b); snd($sock_a, $port_b, rtp(101, 1023, 6040, 0x1234, "\x03\x26\x01\xe0")); -rcv($sock_b, $port_a, rtpm(101, 1025, 6200, 0x1234, "\x01\x0c\x01\x40")); +rcv($sock_b, $port_a, rtpm(101 | 0x80, 1025, 6360, 0x1234, "\x01\x0c\x00\xa0")); snd($sock_a, $port_b, rtp(101, 1024, 6040, 0x1234, "\x03\x26\x02\x80")); -rcv($sock_b, $port_a, rtpm(101, 1026, 6200, 0x1234, "\x01\x0c\x01\xe0")); +rcv($sock_b, $port_a, rtpm(101, 1026, 6360, 0x1234, "\x01\x0c\x01\x40")); snd($sock_a, $port_b, rtp(101, 1025, 6040, 0x1234, "\x03\x26\x03\x20")); -rcv($sock_b, $port_a, rtpm(101, 1027, 6200, 0x1234, "\x01\x0c\x02\x80")); +rcv($sock_b, $port_a, rtpm(101, 1027, 6360, 0x1234, "\x01\x0c\x01\xe0")); # send end event snd($sock_a, $port_b, rtp(101, 1026, 6040, 0x1234, "\x03\xa6\x03\xc0")); -rcv($sock_b, $port_a, rtpm(101, 1028, 6200, 0x1234, "\x01\x8c\x03\x20")); -rcv($sock_b, $port_a, rtpm(101, 1029, 6200, 0x1234, "\x01\x8c\x03\x20")); -rcv($sock_b, $port_a, rtpm(101, 1030, 6200, 0x1234, "\x01\x8c\x03\x20")); snd($sock_a, $port_b, rtp(101, 1027, 6040, 0x1234, "\x03\xa6\x03\xc0")); -rcv_no($sock_b); snd($sock_a, $port_b, rtp(101, 1028, 6040, 0x1234, "\x03\xa6\x03\xc0")); +rcv($sock_b, $port_a, rtpm(101, 1028, 6360, 0x1234, "\x01\x0c\x02\x80")); rcv_no($sock_b); # send audio, receive end event snd($sock_a, $port_b, rtp(8, 1029, 7000, 0x1234, "\x00" x 160)); -rcv($sock_b, $port_a, rtpm(8, 1033, 7000, 0x1234, "\x00" x 160)); +rcv($sock_b, $port_a, rtpm(101, 1029, 6360, 0x1234, "\x01\x8c\x03\x20")); +rcv($sock_b, $port_a, rtpm(101, 1030, 6360, 0x1234, "\x01\x8c\x03\x20")); +rcv($sock_b, $port_a, rtpm(101, 1031, 6360, 0x1234, "\x01\x8c\x03\x20")); + +snd($sock_a, $port_b, rtp(8, 1030, 7160, 0x1234, "\x00" x 160)); +rcv($sock_b, $port_a, rtpm(8, 1032, 7160, 0x1234, "\x00" x 160));