From bf841c5243873c52d7b9acfc755d3ea88d42c9f1 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 4 Apr 2025 09:39:48 -0400 Subject: [PATCH] MT#55283 add handler_func_passthrough_stub The stub is used for unknown payload types. Specialise the handler function for it with an extra check for DTX usage. This effectively blocks RTP packets with unknown payload types if DTX has been configured. Forwarding RTP packets with unknown payload types can interfere with a clean output stream generated by the DTX buffer. Change-Id: I6f0aa9654946d2877b963cd13cec7c3f5c8b1c54 --- daemon/codec.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/daemon/codec.c b/daemon/codec.c index 29d9f474e..47478db4d 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -306,6 +306,7 @@ static void codec_output_rtp_seq_own(struct media_packet *mp, struct codec_sched static codec_handler_func handler_func_passthrough_ssrc; +static codec_handler_func handler_func_passthrough_stub; static codec_handler_func handler_func_transcode; static codec_handler_func handler_func_playback; static codec_handler_func handler_func_inject_dtmf; @@ -360,7 +361,7 @@ static void __buffer_delay_seq(struct delay_buffer *dbuf, struct media_packet *m static struct codec_handler codec_handler_stub_ssrc = { .source_pt.payload_type = -1, .dest_pt.payload_type = -1, - .handler_func = handler_func_passthrough_ssrc, + .handler_func = handler_func_passthrough_stub, .kernelize = true, .passthrough = true, }; @@ -2942,6 +2943,14 @@ void codec_init_payload_type(rtp_payload_type *pt, enum media_type type) { #ifdef WITH_TRANSCODING +static int handler_func_passthrough_stub(struct codec_handler *h, struct media_packet *mp) { + if (G_UNLIKELY(!mp->rtp)) + return handler_func_passthrough(h, mp); + if (rtpe_config.dtx_delay) + return 0; + return handler_func_passthrough_ssrc(h, mp); +} + static int handler_func_passthrough_ssrc(struct codec_handler *h, struct media_packet *mp) { if (G_UNLIKELY(!mp->rtp)) return handler_func_passthrough(h, mp);