diff --git a/daemon/call.c b/daemon/call.c index 89a326043..49f41ecdf 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2427,7 +2427,9 @@ static void codecs_offer(struct call_media *media, struct call_media *other_medi ilogs(codec, LOG_DEBUG, "Updating codecs for answerer " STR_FORMAT " #%u", STR_FMT(&media->monologue->tag), media->index); - if (flags && flags->reuse_codec) + if (flags->static_codecs && media->codecs.codec_prefs.length) + ilogs(codec, LOG_DEBUG, "Leaving answerer codecs alone"); + else if (flags && flags->reuse_codec) codec_store_populate_reuse(&media->codecs, &sp->codecs); else codec_store_populate(&media->codecs, &sp->codecs, diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 52871f64d..61de23d91 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1101,6 +1101,10 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) { case CSH_LOOKUP("no-codec-renegotiation"): out->reuse_codec = 1; break; + case CSH_LOOKUP("static-codec"): + case CSH_LOOKUP("static-codecs"): + out->static_codecs = 1; + break; case CSH_LOOKUP("single-codec"): out->single_codec = 1; break; diff --git a/daemon/codec.c b/daemon/codec.c index 1214820b0..fd28b5e59 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -4954,7 +4954,6 @@ static struct rtp_payload_type *codec_store_find_compatible(struct codec_store * } void __codec_store_populate_reuse(struct codec_store *dst, struct codec_store *src, struct codec_store_args a) { - // start fresh struct call_media *media = dst->media; struct call *call = media ? media->call : NULL; diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index d56087ced..72086dc22 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -981,6 +981,12 @@ Spaces in each string may be replaced by hyphens. and will remove all others from the list. Useful for RTP clients which get confused if more than one codec is listed in an answer. +* `static codecs` + + Useful in an `offer` message to suppress any change in codecs towards the + answer side, instead of passing along the list of offered codecs from the + offer side as it normally would. + * `SIP source address` Ignore any IP addresses given in the SDP body and use the source address of the received diff --git a/include/call_interfaces.h b/include/call_interfaces.h index ec62185b0..b3a3d8952 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -166,6 +166,7 @@ struct sdp_ng_flags { original_sendrecv:1, single_codec:1, reuse_codec:1, + static_codecs:1, allow_transcoding:1, allow_asymmetric_codecs:1, early_media:1, diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 4ac7a2916..638b4896f 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -179,6 +179,338 @@ SDP +new_call; + +offer('static codecs control', { codec => { transcode => + ['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'], + }}, < { transcode => + ['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'], + }}, < { transcode => + ['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'], + }, flags => ['no codec renegotiation'] }, < ['no codec renegotiation'] }, < { transcode => + ['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'], + }, flags => ['no codec renegotiation'] }, < { transcode => + ['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'], + }, flags => ['static codecs'] }, < ['static codecs'] }, < { transcode => + ['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'], + }, flags => ['static codecs'] }, <