MT#55283 rename rtp_payload_type_fmt_eq

... to _cmp as it better matches its return value.

Also annotate these functions with nonnull.

Change-Id: Iebc725e011bab60ecf089407f16efce0accaf133
pull/1759/head
Richard Fuchs 2 years ago
parent 2364464fc7
commit 19a0b93850

@ -4732,7 +4732,7 @@ static void codec_store_find_matching_codecs(GQueue *out_compat, struct rtp_payl
ensure_codec_def(pt2, cs->media);
int match;
if (pt)
match = rtp_payload_type_fmt_eq(pt, pt2);
match = rtp_payload_type_fmt_cmp(pt, pt2);
else
match = (str_cmp_str(codec, &pt2->encoding) == 0) ? 0 : -1;
if (match == 0) {

@ -145,6 +145,7 @@ const struct rtp_payload_type *rtp_get_rfc_codec(const str *codec) {
}
// helper function: matches only basic params, without matching payload type number
__attribute__((nonnull(1, 2)))
static bool rtp_payload_type_fmt_eq_nf(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
if (a->clock_rate != b->clock_rate)
return false;
@ -157,7 +158,7 @@ static bool rtp_payload_type_fmt_eq_nf(const struct rtp_payload_type *a, const s
// matches basic params and format params, but not payload type number
// returns matching val as per format_cmp_f
int rtp_payload_type_fmt_eq(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
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) {
@ -171,21 +172,21 @@ int rtp_payload_type_fmt_eq(const struct rtp_payload_type *a, const struct rtp_p
return 0;
}
bool rtp_payload_type_fmt_eq_exact(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
return rtp_payload_type_fmt_eq(a, b) == 0;
return rtp_payload_type_fmt_cmp(a, b) == 0;
}
bool rtp_payload_type_fmt_eq_compat(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
return rtp_payload_type_fmt_eq(a, b) >= 0;
return rtp_payload_type_fmt_cmp(a, b) >= 0;
}
bool rtp_payload_type_eq_exact(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
if (a->payload_type != b->payload_type)
return false;
return rtp_payload_type_fmt_eq(a, b) == 0;
return rtp_payload_type_fmt_cmp(a, b) == 0;
}
bool rtp_payload_type_eq_compat(const struct rtp_payload_type *a, const struct rtp_payload_type *b) {
if (a->payload_type != b->payload_type)
return false;
return rtp_payload_type_fmt_eq(a, b) >= 0;
return rtp_payload_type_fmt_cmp(a, b) >= 0;
}
// same as rtp_payload_type_fmt_eq_nf plus matching payload type number

@ -125,13 +125,19 @@ const struct rtp_payload_type *rtp_get_rfc_codec(const str *codec);
// if not `exact` then also returns true if `a` is compatible with `b`
// matches all params
__attribute__((nonnull(1, 2)))
bool rtp_payload_type_eq_exact(const struct rtp_payload_type *a, const struct rtp_payload_type *b);
__attribute__((nonnull(1, 2)))
bool rtp_payload_type_eq_compat(const struct rtp_payload_type *a, const struct rtp_payload_type *b);
// matches only basic params and payload type number
__attribute__((nonnull(1, 2)))
bool rtp_payload_type_eq_nf(const struct rtp_payload_type *, const struct rtp_payload_type *);
// matches all params except payload type number
int rtp_payload_type_fmt_eq(const struct rtp_payload_type *a, const struct rtp_payload_type *b);
__attribute__((nonnull(1, 2)))
int rtp_payload_type_fmt_cmp(const struct rtp_payload_type *a, const struct rtp_payload_type *b);
__attribute__((nonnull(1, 2)))
bool rtp_payload_type_fmt_eq_exact(const struct rtp_payload_type *a, const struct rtp_payload_type *b);
__attribute__((nonnull(1, 2)))
bool rtp_payload_type_fmt_eq_compat(const struct rtp_payload_type *a, const struct rtp_payload_type *b);

Loading…
Cancel
Save