Browse Source

MT#55283 extend G729a compatibility

Change-Id: I6079d06ada8acec1771f27677f3043d34e4c9f20
(cherry picked from commit 7893b1a830)
mr12.5
Richard Fuchs 7 months ago
parent
commit
223f3a8166
3 changed files with 220 additions and 6 deletions
  1. +7
    -2
      lib/codeclib.c
  2. +22
    -4
      lib/rtplib.c
  3. +191
    -0
      t/auto-daemon-tests.pl

+ 7
- 2
lib/codeclib.c View File

@ -1625,8 +1625,13 @@ void codeclib_init(int print) {
const struct rtp_payload_type *pt = rtp_get_rfc_codec(&def->rtpname_str);
if (pt)
def->rfc_payload_type = pt->payload_type;
else
def->rfc_payload_type = -1;
else {
// special case:
if (!strcmp(def->rtpname, "G729a"))
def->rfc_payload_type = 18;
else
def->rfc_payload_type = -1;
}
if (def->codec_type && def->codec_type->def_init)
def->codec_type->def_init(def);


+ 22
- 4
lib/rtplib.c View File

@ -150,8 +150,25 @@ bool rtp_payload_type_fmt_eq_nf(const struct rtp_payload_type *a, const struct r
return false;
if (a->channels != b->channels)
return false;
if (str_casecmp_str(&a->encoding, &b->encoding))
if (str_casecmp_str(&a->encoding, &b->encoding)) {
#ifdef WITH_TRANSCODING
// last ditch effort: see if it's a botched alias name (AKA G729a)
if (!a->codec_def || !b->codec_def)
return false;
if (a->codec_def->rfc_payload_type == -1 || b->codec_def->rfc_payload_type == -1)
return false;
if (a->codec_def->rfc_payload_type != b->codec_def->rfc_payload_type)
return false;
if (a->codec_def->codec_type != b->codec_def->codec_type)
return false;
if (a->codec_def->avcodec_id != b->codec_def->avcodec_id)
return false;
// consider them the same
return true;
#else
return false;
#endif
}
return true;
}
@ -160,9 +177,10 @@ bool rtp_payload_type_fmt_eq_nf(const struct rtp_payload_type *a, const struct r
int rtp_payload_type_fmt_cmp(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
if (!rtp_payload_type_fmt_eq_nf(a, b))
return -1;
if (a->codec_def && a->codec_def == b->codec_def) {
if (a->codec_def->format_cmp)
return a->codec_def->format_cmp(a, b);
if (a->codec_def && b->codec_def
&& a->codec_def->format_cmp
&& a->codec_def->format_cmp == b->codec_def->format_cmp) {
return a->codec_def->format_cmp(a, b);
}
if (!a->codec_def) // ignore format of codecs we don't know
return 0;


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

@ -294,6 +294,8 @@ a=sendrecv
a=rtcp:PORT
SDP
if ($extended_tests) {
new_call;
offer('mismatched G.729 annexb', { }, <<SDP);
@ -418,6 +420,195 @@ a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('rtpmap default mismatched G.729 annexb', { }, <<SDP);
v=0
o=- 13111259 1 IN IP4 1.2.3.4
s=-
c=IN IP4 1.2.3.4
t=0 0
m=audio 23874 RTP/AVP 9 8 0 18 100
a=rtpmap:100 telephone-event/8000
a=ptime:20
----------------------------
v=0
o=- 13111259 1 IN IP4 1.2.3.4
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 9 8 0 18 100
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:100 telephone-event/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('rtpmap default mismatched G.729 annexb', { }, <<SDP);
v=0
o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7
s=SIP call
c=IN IP4 5.6.7.7
t=0 0
m=audio 49696 RTP/AVP 8 0 18 100
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729a/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-11
a=ptime:20
a=maxptime:30
a=sendrecv
----------------------------
v=0
o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7
s=SIP call
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 0 18 100
a=maxptime:30
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729a/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-11
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('rtpmap mismatched G.729 annexb', { }, <<SDP);
v=0
o=- 13111259 1 IN IP4 1.2.3.4
s=-
c=IN IP4 1.2.3.4
t=0 0
m=audio 23874 RTP/AVP 9 8 0 18 100
a=rtpmap:100 telephone-event/8000
a=ptime:20
----------------------------
v=0
o=- 13111259 1 IN IP4 1.2.3.4
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 9 8 0 18 100
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:100 telephone-event/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('rtpmap mismatched G.729 annexb', { }, <<SDP);
v=0
o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7
s=SIP call
c=IN IP4 5.6.7.7
t=0 0
m=audio 49696 RTP/AVP 8 0 18 100
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729a/8000
a=fmtp:18 annexb=no
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-11
a=ptime:20
a=maxptime:30
a=sendrecv
----------------------------
v=0
o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7
s=SIP call
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 0 18 100
a=maxptime:30
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729a/8000
a=fmtp:18 annexb=no
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-11
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
new_call;
offer('actually rtpmap mismatched G.729 annexb', { }, <<SDP);
v=0
o=- 13111259 1 IN IP4 1.2.3.4
s=-
c=IN IP4 1.2.3.4
t=0 0
m=audio 23874 RTP/AVP 9 8 0 18 100
a=rtpmap:100 telephone-event/8000
a=ptime:20
----------------------------
v=0
o=- 13111259 1 IN IP4 1.2.3.4
s=-
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 9 8 0 18 100
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:100 telephone-event/8000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
answer('actually rtpmap mismatched G.729 annexb', { }, <<SDP);
v=0
o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7
s=SIP call
c=IN IP4 5.6.7.7
t=0 0
m=audio 49696 RTP/AVP 8 0 18 100
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729a/8000
a=fmtp:18 annexb=yes
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-11
a=ptime:20
a=maxptime:30
a=sendrecv
----------------------------
v=0
o=- 1737116508926565 1737116508926565 IN IP4 5.6.7.7
s=SIP call
c=IN IP4 203.0.113.1
t=0 0
m=audio PORT RTP/AVP 8 0 100
a=maxptime:30
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-11
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
}
new_call;
offer('original sendrecv control', { }, <<SDP);


Loading…
Cancel
Save