From b05488fd5d4061660ec05a212bc74ed1dc218f13 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 3 Nov 2026 16:15:58 +0100 Subject: [PATCH] MT#66417 codec_add_dtmf_packet: add room for the header extension A fix-up for 4fbef394 Since that commit, the printer adds the `mid` from the egress media extmap even when the input had none and the older bug (with the missing room in `codec_add_dtmf_packet()`) started corrupting packets. Just reserve the extension room in the same way the `codec_add_raw_packet_dup()` and the `packet_encoded_packetize()` already do. An example of bug triggered: chrome sending the DTMF with no extensions. Change-Id: I87a61e1f87e896609e76bbdf87b4c7827027f39d (cherry picked from commit f950a9f7be6edf760ce622a461610e8440ddac14) --- daemon/codec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index da720bb69..febe3eabe 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -2654,9 +2654,10 @@ static int codec_add_dtmf_packet(struct codec_ssrc_handler *ch, struct codec_ssr skip: ssrc_entry_release(output_ch); + size_t ext_len = mp->sink.rtpext->length(mp); char *buf = bufferpool_alloc(media_bufferpool, - packet->payload->len + sizeof(struct rtp_header) + RTP_BUFFER_TAIL_ROOM); - memcpy(buf + sizeof(struct rtp_header), packet->payload->s, packet->payload->len); + packet->payload->len + sizeof(struct rtp_header) + ext_len + RTP_BUFFER_TAIL_ROOM); + memcpy(buf + sizeof(struct rtp_header) + ext_len, packet->payload->s, packet->payload->len); if (packet->bypass_seq) // inject original seq codec_output_rtp(mp, &ch->csch, packet->handler ? : h, buf, packet->payload->len, packet->ts, (struct rtp_markers) { .marker = packet->marker },