From a8ae12a5453d4d9efb48942af3303e88785f59fb Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 10 Jul 2025 15:41:00 -0400 Subject: [PATCH] MT#55283 ignore G.729 fmtp closes #1971 Change-Id: Ide2577b76de1f26844a9c73e169bcad96ee2a90e (cherry picked from commit 799830902ed2be93156f19c75fa8cc8060dbf107) (cherry picked from commit 33299ed1203e4b08636ac49cae4efa74cbc8a520) --- lib/codeclib.c | 21 ++------------------- t/auto-daemon-tests.pl | 15 +++++++++++---- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/lib/codeclib.c b/lib/codeclib.c index 2fef4f855..d7a52b3b2 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -366,7 +366,6 @@ static const dtx_method_t dtx_method_evs = { #ifdef HAVE_BCG729 static packetizer_f packetizer_g729; // aggregate some frames into packets -static format_cmp_f format_cmp_g729; static void bcg729_def_init(struct codec_def_s *); static const char *bcg729_decoder_init(decoder_t *, const str *); @@ -517,7 +516,7 @@ static struct codec_def_s __codec_defs[] = { .default_ptime = 20, .minimum_ptime = 20, .default_fmtp = "annexb=yes", - .format_cmp = format_cmp_g729, + .format_cmp = format_cmp_ignore, .packetizer = packetizer_g729, .bits_per_sample = 1, // 10 ms frame has 80 samples and encodes as (max) 10 bytes = 80 bits .media_type = MT_AUDIO, @@ -536,7 +535,7 @@ static struct codec_def_s __codec_defs[] = { .default_ptime = 20, .minimum_ptime = 20, .default_fmtp = "annexb=no", - .format_cmp = format_cmp_g729, + .format_cmp = format_cmp_ignore, .packetizer = packetizer_g729, .bits_per_sample = 1, // 10 ms frame has 80 samples and encodes as (max) 10 bytes = 80 bits .media_type = MT_AUDIO, @@ -3623,22 +3622,6 @@ static int packetizer_g729(AVPacket *pkt, GString *buf, str *input_output, encod input_output->len = output.s - input_output->s; return buf->len >= 2 ? 1 : 0; } - -static bool g729_is_annex_b(const struct rtp_payload_type *p) { - // defaults based on codec name (G729 vs G729a) - bool annex_b = p->encoding.len && !((p->encoding.s[p->encoding.len - 1] & 0xdf) == 'A'); - // override per fmtp - if (str_str(&p->format_parameters, "annexb=no") != -1) - annex_b = false; - else if (str_str(&p->format_parameters, "annexb=yes") != -1) - annex_b = true; - return annex_b; -} -static int format_cmp_g729(const struct rtp_payload_type *a, const struct rtp_payload_type *b) { - bool a_b = g729_is_annex_b(a); - bool b_b = g729_is_annex_b(b); - return a_b == b_b ? 0 : -1; -} #endif diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 639c997f1..0da34e879 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -613,10 +613,12 @@ o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7 s=SIP call c=IN IP4 203.0.113.1 t=0 0 -m=audio PORT RTP/AVP 8 0 100 +m=audio PORT RTP/AVP 8 0 18 100 a=maxptime:30 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=rtpmap:18 G729/8000 +a=fmtp:18 annexb=no a=rtpmap:100 telephone-event/8000 a=fmtp:100 0-11 a=sendrecv @@ -674,10 +676,11 @@ o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7 s=SIP call c=IN IP4 203.0.113.1 t=0 0 -m=audio PORT RTP/AVP 8 0 100 +m=audio PORT RTP/AVP 8 0 18 100 a=maxptime:30 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=rtpmap:18 G729a/8000 a=rtpmap:100 telephone-event/8000 a=fmtp:100 0-11 a=sendrecv @@ -735,10 +738,12 @@ o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7 s=SIP call c=IN IP4 203.0.113.1 t=0 0 -m=audio PORT RTP/AVP 8 0 100 +m=audio PORT RTP/AVP 8 0 18 100 a=maxptime:30 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=rtpmap:18 G729a/8000 +a=fmtp:18 annexb=no a=rtpmap:100 telephone-event/8000 a=fmtp:100 0-11 a=sendrecv @@ -796,10 +801,12 @@ o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7 s=SIP call c=IN IP4 203.0.113.1 t=0 0 -m=audio PORT RTP/AVP 8 0 100 +m=audio PORT RTP/AVP 8 0 18 100 a=maxptime:30 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 +a=rtpmap:18 G729a/8000 +a=fmtp:18 annexb=no a=rtpmap:100 telephone-event/8000 a=fmtp:100 0-11 a=sendrecv