diff --git a/lib/codeclib.c b/lib/codeclib.c index f37f0dc40..0bb81b61f 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -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); diff --git a/lib/rtplib.c b/lib/rtplib.c index 766404c9e..9f6359e4e 100644 --- a/lib/rtplib.c +++ b/lib/rtplib.c @@ -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; diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 79f79e63a..46ae86ea5 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -294,6 +294,8 @@ a=sendrecv a=rtcp:PORT SDP +if ($extended_tests) { + new_call; offer('mismatched G.729 annexb', { }, <