From a3835b001dbdfd639b34f6530817a3ae9a775bb8 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 30 Oct 2022 11:32:07 +0100 Subject: [PATCH] AMPS: Minor fixes at DTX handling --- src/amps/amps.c | 7 ------- src/amps/dsp.c | 8 ++++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/amps/amps.c b/src/amps/amps.c index 79332d4..dafff22 100644 --- a/src/amps/amps.c +++ b/src/amps/amps.c @@ -819,13 +819,6 @@ void amps_rx_sat(amps_t *amps, int tone, double quality) amps_set_dsp_mode(amps, DSP_MODE_AUDIO_RX_FRAME_TX, 0); } - /* no SAT timeout handling during alerting */ - if (trans->state == TRANS_CALL_MT_ALERT - || trans->state == TRANS_CALL_MT_ALERT_SEND - || trans->state == TRANS_CALL_MT_ALERT_CONFIRM - || trans->state == TRANS_CALL_MT_ANSWER_WAIT) - return; - if (tone) { timer_stop(&trans->timer); } else { diff --git a/src/amps/dsp.c b/src/amps/dsp.c index 26bc633..a18abee 100644 --- a/src/amps/dsp.c +++ b/src/amps/dsp.c @@ -125,7 +125,7 @@ #define SIG_LOST_COUNT 4 /* number of measures to loose Signaling Tone */ #define CUT_OFF_HIGHPASS 300.0 /* cut off frequency for high pass filter to remove dc level from sound card / sample */ #define BEST_QUALITY 0.68 /* Best possible RX quality */ -#define COMFORT_NOISE 0.02 /* audio level of comfort noise (relative to ISDN level) */ +#define COMFORT_NOISE 0.02 /* audio level of comfort noise (relative to speech level) */ static sample_t ramp_up[256], ramp_down[256]; @@ -253,6 +253,7 @@ int dsp_init_sender(amps_t *amps, int tolerant) PDEBUG(DDSP, DEBUG_ERROR, "No memory!\n"); return -ENOMEM; } + PDEBUG(DDSP, DEBUG_DEBUG, "Sat detection interval is %d ms.\n", amps->sat_samples * 1000 / amps->sender.samplerate); amps->sat_filter_spl = spl; /* count SAT tones */ @@ -840,7 +841,7 @@ static void sat_decode(amps_t *amps, sample_t *samples, int length) static void sender_receive_audio(amps_t *amps, sample_t *samples, int length) { transaction_t *trans = amps->trans_list; - sample_t *spl; + sample_t *spl, s; int max, pos; int i; @@ -849,7 +850,10 @@ static void sender_receive_audio(amps_t *amps, sample_t *samples, int length) spl = amps->sat_filter_spl; pos = amps->sat_filter_pos; for (i = 0; i < length; i++) { + /* unmute: use buffer, to delay audio, so we do not miss that chunk when SAT is detected */ + s = spl[pos]; spl[pos++] = samples[i]; + samples[i] = s; if (pos == max) { pos = 0; sat_decode(amps, spl, max);