From 063efc60a778ac86c8728140710a5bddf32e8d34 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 30 Jun 2026 09:22:05 -0400 Subject: [PATCH] MT#65388 support passthrough + transcoding With the more modern codec handling, there shouldn't be any more need to unconditionally remove unsupported codecs if some codecs are requested for transcoding. Change-Id: Ica931de24ad6042f82e06d2efa69b93b4a7d8dd0 --- daemon/codec.c | 16 ------------ t/auto-daemon-tests.pl | 4 ++- t/test-transcode.c | 57 +++++++++++++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 26 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index f12f1fd22..87169eac4 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -1874,22 +1874,6 @@ next: if (a.reset_transcoding && ms) ms->attrs.transcoding = true; - for (__auto_type l = source->codecs.codec_prefs.head; l; ) { - rtp_payload_type *pt = l->data; - - if (codec_def_supported(pt->codec_def)) { - // supported - l = l->next; - continue; - } - - ilogs(codec, LOG_DEBUG, "Stripping unsupported codec " STR_FORMAT - " due to active transcoding", - STR_FMT(&pt->encoding)); - codec_touched(&source->codecs, pt); - l = __codec_store_delete_link(l, &source->codecs); - } - if (!use_audio_player || !pref_dest_codec) { // we have to translate RTCP packets source->rtcp_handler = rtcp_transcode_handler; diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index fa5caff84..5895cbb0a 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -12288,8 +12288,10 @@ v=0 o=- 1545997027 1 IN IP4 172.17.0.2 s=tester t=0 0 -m=audio PORT RTP/AVP 104 110 102 108 8 0 105 100 +m=audio PORT RTP/AVP 109 104 110 102 108 8 0 105 100 c=IN IP4 203.0.113.1 +a=rtpmap:109 EVS/16000 +a=fmtp:109 br=5.9-24.4; bw=nb-swb; max-red=220; cmr=1; ch-aw-recv=3 a=rtpmap:104 speex/16000 a=fmtp:104 max-red=0; mode-change-capability=2 a=rtpmap:110 speex/16000 diff --git a/t/test-transcode.c b/t/test-transcode.c index eee3a5390..ae3d39b24 100644 --- a/t/test-transcode.c +++ b/t/test-transcode.c @@ -1182,7 +1182,7 @@ int main(void) { transcode(GSM); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(101, telephone-event, 8000); answer(); @@ -1202,7 +1202,7 @@ int main(void) { transcode(GSM); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(3, GSM, 8000); sdp_pt(101, telephone-event, 8000); @@ -1228,7 +1228,7 @@ int main(void) { c_consume(PCMU); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(101, telephone-event, 8000); answer(); @@ -1248,7 +1248,7 @@ int main(void) { transcode(GSM); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(101, telephone-event, 8000); answer(); @@ -1268,7 +1268,7 @@ int main(void) { transcode(GSM); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(3, GSM, 8000); sdp_pt(101, telephone-event, 8000); @@ -1288,7 +1288,7 @@ int main(void) { c_accept(PCMU); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(101, telephone-event, 8000); answer(); @@ -1308,7 +1308,7 @@ int main(void) { transcode(GSM); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(101, telephone-event, 8000); answer(); @@ -1328,7 +1328,7 @@ int main(void) { transcode(GSM); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 3/GSM/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(3, GSM, 8000); sdp_pt(101, telephone-event, 8000); @@ -1348,7 +1348,7 @@ int main(void) { c_accept(G722); offer(); expect(A, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); - expect(B, "9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000"); + expect(B, "104/SILK/16000 9/G722/8000 0/PCMU/8000 8/PCMA/8000 101/telephone-event/8000 13/CN/8000 118/CN/16000"); sdp_pt(8, PCMA, 8000); sdp_pt(101, telephone-event, 8000); answer(); @@ -1746,6 +1746,45 @@ int main(void) { expect(B, "8/PCMA/8000"); end(); + start(); + sdp_pt_s(96, dummy, 48000); + sdp_pt(8, PCMA, 8000); + transcode(PCMU); + offer(); + expect(A, "96/dummy/48000/2 8/PCMA/8000"); + expect(B, "96/dummy/48000/2 8/PCMA/8000 0/PCMU/8000"); + sdp_pt(8, PCMA, 8000); + answer(); + expect(A, "8/PCMA/8000"); + expect(B, "8/PCMA/8000"); + end(); + + start(); + sdp_pt_s(96, dummy, 48000); + sdp_pt(8, PCMA, 8000); + transcode(PCMU); + offer(); + expect(A, "96/dummy/48000/2 8/PCMA/8000"); + expect(B, "96/dummy/48000/2 8/PCMA/8000 0/PCMU/8000"); + sdp_pt(0, PCMU, 8000); + answer(); + expect(A, "8/PCMA/8000"); + expect(B, "0/PCMU/8000"); + end(); + + start(); + sdp_pt_s(96, dummy, 48000); + sdp_pt(8, PCMA, 8000); + transcode(PCMU); + offer(); + expect(A, "96/dummy/48000/2 8/PCMA/8000"); + expect(B, "96/dummy/48000/2 8/PCMA/8000 0/PCMU/8000"); + sdp_pt_s(96, dummy, 48000); + answer(); + expect(A, "96/dummy/48000/2"); + expect(B, "96/dummy/48000/2"); + end(); + statistics_free(); bufferpool_destroy(media_bufferpool); bufferpool_destroy(shm_bufferpool);