Browse Source

TT#92250 add `single codec` flag

Change-Id: I7c84e1f906fec93ed624d2fb4a4d9e9bfc9b4109
pull/1093/head
Richard Fuchs 5 years ago
parent
commit
653b09ca93
5 changed files with 131 additions and 0 deletions
  1. +6
    -0
      README.md
  2. +3
    -0
      daemon/call_interfaces.c
  3. +19
    -0
      daemon/codec.c
  4. +1
    -0
      include/call_interfaces.h
  5. +102
    -0
      t/auto-daemon-tests.pl

+ 6
- 0
README.md View File

@ -774,6 +774,12 @@ Optionally included keys are:
PCMA. With this flag however, *rtpengine* honours the single accepted codec from the
answer and so is able to eliminate PCMA from its own answer as it's not needed.
- `single codec`
Using this flag in an `answer` message will leave only the first listed codec in place
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.
- `all`
Only relevant to the `unblock media` message. Instructs *rtpengine* to remove not only a


+ 3
- 0
daemon/call_interfaces.c View File

@ -816,6 +816,9 @@ static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) {
case CSH_LOOKUP("symmetric-codecs"):
out->symmetric_codecs = 1;
break;
case CSH_LOOKUP("single-codec"):
out->single_codec = 1;
break;
case CSH_LOOKUP("inject-DTMF"):
out->inject_dtmf = 1;
break;


+ 19
- 0
daemon/codec.c View File

@ -2572,6 +2572,25 @@ void codec_rtp_payload_types(struct call_media *media, struct call_media *other_
}
}
if (flags->opmode == OP_ANSWER && flags->single_codec) {
int have_codec = 0;
for (GList *l = media->codecs_prefs_recv.head; l;) {
struct rtp_payload_type *pt = l->data;
ensure_codec_def(pt, media);
if (pt->codec_def && pt->codec_def->supplemental) {
// leave these alone
l = l->next;
continue;
}
if (!have_codec) {
have_codec = 1;
l = l->next;
continue;
}
l = __delete_receiver_codec(media, l);
}
}
#ifdef WITH_TRANSCODING
// add transcode codecs
for (GList *l = flags->codec_transcode.head; l; l = l->next) {


+ 1
- 0
include/call_interfaces.h View File

@ -80,6 +80,7 @@ struct sdp_ng_flags {
always_transcode:1,
asymmetric_codecs:1,
symmetric_codecs:1,
single_codec:1,
inject_dtmf:1,
t38_decode:1,
t38_force:1,


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

@ -1045,6 +1045,108 @@ rcv($sock_a, $port_b, rtpm(96, 1004, 4200, $ssrc, "\xf0\x14\x41\x00\x30\x44\x41\
new_call;
offer('multi codec offer/answer', {
ICE => 'remove',
flags => [],
}, <<SDP);
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 89.225.243.254
t=0 0
m=audio 8000 RTP/AVP 0 8
a=sendrecv
--------------------------------------
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('multi codec offer/answer', {
ICE => 'remove',
flags => [],
}, <<SDP);
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 89.225.243.254
t=0 0
m=audio 8000 RTP/AVP 0 8
a=sendrecv
--------------------------------------
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
new_call;
offer('multi codec offer/answer w single-codec', {
ICE => 'remove',
flags => [],
}, <<SDP);
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 89.225.243.254
t=0 0
m=audio 8000 RTP/AVP 0 8
a=sendrecv
--------------------------------------
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('multi codec offer/answer', {
ICE => 'remove',
flags => ['single codec'],
}, <<SDP);
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 89.225.243.254
t=0 0
m=audio 8000 RTP/AVP 0 8
a=sendrecv
--------------------------------------
v=0
o=Z 58440449 0 IN IP4 89.225.243.254
s=Z
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtcp:PORT
SDP
new_call;
offer('add transcode w supp codec', {


Loading…
Cancel
Save