diff --git a/daemon/call.c b/daemon/call.c index c423e6a87..3c5d82691 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2687,7 +2687,9 @@ void codecs_offer_answer(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, NULL, false); else codec_store_populate(&media->codecs, &sp->codecs, NULL, false); diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index 14cbae942..46c00b859 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1108,6 +1108,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 c127bd69d..753f10470 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -4660,7 +4660,6 @@ static void codec_store_add_end(struct codec_store *cs, struct rtp_payload_type void codec_store_populate_reuse(struct codec_store *dst, struct codec_store *src, GHashTable *codec_set, bool answer_only) { - // 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 628f7b864..19082e551 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -950,6 +950,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 ac2ead366..2f2ec7df4 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -164,6 +164,7 @@ struct sdp_ng_flags { original_sendrecv:1, single_codec:1, reuse_codec:1, + static_codecs:1, allow_transcoding:1, early_media:1, accept_any:1, diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 83cf50aa6..323fc7c08 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -80,6 +80,340 @@ sub stun_succ { + + +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'] }, <