Browse Source

MT#58636 add new option 'static codecs'

Change-Id: Ife8ef86ff0c6dd8733fd063d8ce19f6baaa30e58
(cherry picked from commit 76203fdce9)
pull/1887/head
Richard Fuchs 2 years ago
parent
commit
952a81bd93
6 changed files with 346 additions and 2 deletions
  1. +3
    -1
      daemon/call.c
  2. +4
    -0
      daemon/call_interfaces.c
  3. +0
    -1
      daemon/codec.c
  4. +6
    -0
      docs/ng_control_protocol.md
  5. +1
    -0
      include/call_interfaces.h
  6. +332
    -0
      t/auto-daemon-tests.pl

+ 3
- 1
daemon/call.c View File

@ -2412,7 +2412,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,


+ 4
- 0
daemon/call_interfaces.c View File

@ -1099,6 +1099,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;


+ 0
- 1
daemon/codec.c View File

@ -4880,7 +4880,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;


+ 6
- 0
docs/ng_control_protocol.md View File

@ -973,6 +973,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


+ 1
- 0
include/call_interfaces.h View File

@ -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,


+ 332
- 0
t/auto-daemon-tests.pl View File

@ -82,6 +82,338 @@ sub stun_succ {
new_call;
offer('static codecs control', { codec => { transcode =>
['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'],
}}, <<SDP);
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 3110 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
--------------------------------
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 0 96 97 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:96 opus/48000/2
a=fmtp:96 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:97 telephone-event/48000
a=fmtp:97 0-15
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('static codecs control', {}, <<SDP);
v=0
o=- 2405046764736097547 2405046764736097548 IN IP4 192.168.178.99
s=SDP data
c=IN IP4 192.168.178.99
t=0 0
m=audio 6002 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=silenceSupp:off - - - -
a=fmtp:101 0-15
a=ptime:20
a=mptime:20 20 -
a=sendrecv
--------------------------------
v=0
o=- 2405046764736097547 2405046764736097548 IN IP4 192.168.178.99
s=SDP data
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 101
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
offer('static codecs control', { codec => { transcode =>
['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'],
}}, <<SDP);
v=0
o=- 2405046764736097547 2405046764736097550 IN IP4 192.168.178.104
s=SDP data
c=IN IP4 192.168.178.104
t=0 0
m=audio 15028 RTP/AVP 0 8 97 98 96
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 opus/48000/2
a=fmtp:97 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-15
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=sendrecv
a=rtcp:39279
a=mid:0
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=ptime:20
--------------------------------
v=0
o=- 2405046764736097547 2405046764736097550 IN IP4 192.168.178.104
s=SDP data
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 0 8 97 98 96
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=mid:0
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 opus/48000/2
a=fmtp:97 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-15
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('static codecs (reuse control)', { codec => { transcode =>
['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'],
}, flags => ['no codec renegotiation'] }, <<SDP);
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 3110 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
--------------------------------
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 0 96 97 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:96 opus/48000/2
a=fmtp:96 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:97 telephone-event/48000
a=fmtp:97 0-15
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('static codecs (reuse control)', {flags => ['no codec renegotiation'] }, <<SDP);
v=0
o=- 2405046764736097547 2405046764736097548 IN IP4 192.168.178.99
s=SDP data
c=IN IP4 192.168.178.99
t=0 0
m=audio 6002 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=silenceSupp:off - - - -
a=fmtp:101 0-15
a=ptime:20
a=mptime:20 20 -
a=sendrecv
--------------------------------
v=0
o=- 2405046764736097547 2405046764736097548 IN IP4 192.168.178.99
s=SDP data
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 101
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
offer('static codecs (reuse control)', { codec => { transcode =>
['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'],
}, flags => ['no codec renegotiation'] }, <<SDP);
v=0
o=- 2405046764736097547 2405046764736097550 IN IP4 192.168.178.104
s=SDP data
c=IN IP4 192.168.178.104
t=0 0
m=audio 15028 RTP/AVP 0 8 97 98 96
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 opus/48000/2
a=fmtp:97 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-15
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=sendrecv
a=rtcp:39279
a=mid:0
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=ptime:20
--------------------------------
v=0
o=- 2405046764736097547 2405046764736097550 IN IP4 192.168.178.104
s=SDP data
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 0 97 98 96
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=mid:0
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:97 opus/48000/2
a=fmtp:97 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-15
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('static codecs', { codec => { transcode =>
['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'],
}, flags => ['static codecs'] }, <<SDP);
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 3110 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
--------------------------------
v=0
o=- 0 0 IN IP4 127.0.0.1
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 0 96 97 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:96 opus/48000/2
a=fmtp:96 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:97 telephone-event/48000
a=fmtp:97 0-15
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('static codecs', {flags => ['static codecs'] }, <<SDP);
v=0
o=- 2405046764736097547 2405046764736097548 IN IP4 192.168.178.99
s=SDP data
c=IN IP4 192.168.178.99
t=0 0
m=audio 6002 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=silenceSupp:off - - - -
a=ptime:20
a=mptime:20 20 -
a=sendrecv
--------------------------------
v=0
o=- 2405046764736097547 2405046764736097548 IN IP4 192.168.178.99
s=SDP data
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 101
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
offer('static codecs', { codec => { transcode =>
['opus/48000/2///useinbandfec--1;stereo--0;sprop-stereo--0'],
}, flags => ['static codecs'] }, <<SDP);
v=0
o=- 2405046764736097547 2405046764736097550 IN IP4 192.168.178.104
s=SDP data
c=IN IP4 192.168.178.104
t=0 0
m=audio 15028 RTP/AVP 0 8 97 98 96
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 opus/48000/2
a=fmtp:97 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-15
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=sendrecv
a=rtcp:39279
a=mid:0
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=ptime:20
--------------------------------
v=0
o=- 2405046764736097547 2405046764736097550 IN IP4 192.168.178.104
s=SDP data
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 99 96 101
a=silenceSupp:off - - - -
a=mptime:20 20 -
a=mid:0
a=rtpmap:8 PCMA/8000
a=rtpmap:99 opus/48000/2
a=fmtp:99 stereo=0; sprop-stereo=0; useinbandfec=1
a=rtpmap:96 telephone-event/48000
a=fmtp:96 0-15
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('codec reneg control', {


Loading…
Cancel
Save