From 2f5d1707205764f68908b7096d321eefd938e4cc Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 27 Oct 2020 11:12:37 -0400 Subject: [PATCH] TT#92250 ignore format parameters for DTMF codec closes #1098 Change-Id: I180667a7c5fa9da8a95d99826cb3fc4006598976 (cherry picked from commit ee74914b22f752c3e4f9614caba1893977bb9fcf) --- lib/codeclib.c | 9 +++++++++ lib/codeclib.h | 2 ++ lib/rtplib.c | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/lib/codeclib.c b/lib/codeclib.c index 82246b34b..d8c100e40 100644 --- a/lib/codeclib.c +++ b/lib/codeclib.c @@ -62,6 +62,8 @@ static int ilbc_decoder_input(decoder_t *dec, const str *data, GQueue *out); static const char *dtmf_decoder_init(decoder_t *, const str *); static int dtmf_decoder_input(decoder_t *dec, const str *data, GQueue *out); +static int format_cmp_ignore(const struct rtp_payload_type *, const struct rtp_payload_type *); + @@ -393,6 +395,7 @@ static codec_def_t __codec_defs[] = { .default_clockrate = 8000, .default_channels = 1, .default_fmtp = "0-15", + .format_cmp = format_cmp_ignore, .codec_type = &codec_type_dtmf, .support_encoding = 1, .support_decoding = 1, @@ -1936,3 +1939,9 @@ static int dtmf_decoder_input(decoder_t *dec, const str *data, GQueue *out) { return 0; } + + + +static int format_cmp_ignore(const struct rtp_payload_type *a, const struct rtp_payload_type *b) { + return 0; +} diff --git a/lib/codeclib.h b/lib/codeclib.h index 91b98bcb6..3af4e2db3 100644 --- a/lib/codeclib.h +++ b/lib/codeclib.h @@ -69,6 +69,7 @@ typedef int packetizer_f(AVPacket *, GString *, str *, encoder_t *); typedef void format_init_f(struct rtp_payload_type *); typedef void set_enc_options_f(encoder_t *, const str *); typedef void set_dec_options_f(decoder_t *, const str *); +typedef int format_cmp_f(const struct rtp_payload_type *, const struct rtp_payload_type *); @@ -105,6 +106,7 @@ struct codec_def_s { const int default_bitrate; int default_ptime; const char *default_fmtp; + format_cmp_f * const format_cmp; packetizer_f * const packetizer; const int bits_per_sample; const enum media_type media_type; diff --git a/lib/rtplib.c b/lib/rtplib.c index 1c5c6dec6..037302a46 100644 --- a/lib/rtplib.c +++ b/lib/rtplib.c @@ -145,6 +145,10 @@ const struct rtp_payload_type *rtp_get_rfc_codec(const str *codec) { int rtp_payload_type_cmp(const struct rtp_payload_type *a, const struct rtp_payload_type *b) { if (rtp_payload_type_cmp_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 (str_cmp_str(&a->format_parameters, &b->format_parameters)) return 1; return 0;