diff --git a/daemon/call.c b/daemon/call.c index 33ced38bf..5f50b08ca 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2413,7 +2413,9 @@ static void codecs_offer(struct call_media *media, struct call_media *other_medi ilogs(codec, LOG_DEBUG, "Updating offer 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, .merge_cs = &sp->codecs); else diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index d895fdcc4..e5d0b9d49 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1099,6 +1099,10 @@ static void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg 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 14048d37d..ef9c4415c 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -4972,7 +4972,6 @@ static rtp_payload_type *codec_store_find_compatible(struct codec_store *cs, } 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; call_t *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 b9510ced6..6fd9ea254 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -165,6 +165,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 ddef1f9ad..2b5cddce0 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'] }, <