Browse Source

MT#55283 specialise attribute printing funcs

We know whether we're printing for monologues or for medias, so there's
no need to have a generic function signature.

Change-Id: I356747686adb34c19ba2ba4c77c2d0a77b85a364
coverity_scan
Richard Fuchs 9 months ago
parent
commit
e0e4ba5b7c
5 changed files with 18 additions and 18 deletions
  1. +7
    -7
      daemon/sdp.c
  2. +2
    -2
      daemon/t38.c
  3. +2
    -2
      include/call.h
  4. +2
    -2
      include/sdp.h
  5. +5
    -5
      include/types.h

+ 7
- 7
daemon/sdp.c View File

@ -2068,28 +2068,28 @@ static void insert_codec_parameters(GString *s, struct call_media *cm,
}
}
void sdp_insert_media_attributes(GString *gs, union sdp_attr_print_arg a, const sdp_ng_flags *flags) {
void sdp_insert_media_attributes(GString *gs, struct call_media *media, const sdp_ng_flags *flags) {
// Look up the source media. We copy the source's attributes if there is only one source
// media. Otherwise we skip this step.
if (a.cm->media_subscriptions.length != 1)
if (media->media_subscriptions.length != 1)
return;
__auto_type sub = a.cm->media_subscriptions.head->data;
__auto_type sub = media->media_subscriptions.head->data;
__auto_type sub_m = sub->media;
for (__auto_type l = sub_m->generic_attributes.head; l; l = l->next) {
__auto_type s = l->data;
if (s->other == ATTR_OTHER_EXTMAP && flags->strip_extmap && !MEDIA_ISSET(a.cm, PASSTHRU))
if (s->other == ATTR_OTHER_EXTMAP && flags->strip_extmap && !MEDIA_ISSET(media, PASSTHRU))
continue;
append_str_attr_to_gstring(gs, &s->strs.name, &s->strs.value, flags, a.cm->type_id);
append_str_attr_to_gstring(gs, &s->strs.name, &s->strs.value, flags, media->type_id);
}
}
void sdp_insert_monologue_attributes(GString *gs, union sdp_attr_print_arg a, const sdp_ng_flags *flags) {
void sdp_insert_monologue_attributes(GString *gs, struct call_monologue *ml, const sdp_ng_flags *flags) {
// Look up the source monologue. This must be a single source monologue for all medias. If
// there's a mismatch or multiple source monologues, we skip this step.
struct call_monologue *source_ml = ml_medias_subscribed_to_single_ml(a.ml);
struct call_monologue *source_ml = ml_medias_subscribed_to_single_ml(ml);
if (!source_ml)
return;


+ 2
- 2
daemon/t38.c View File

@ -332,8 +332,8 @@ static int span_log_level_map(int level) {
return level;
}
void t38_insert_media_attributes(GString *gs, union sdp_attr_print_arg a, const sdp_ng_flags *flags) {
struct t38_gateway *tg = a.cm->t38_gateway;
static void t38_insert_media_attributes(GString *gs, struct call_media *media, const sdp_ng_flags *flags) {
struct t38_gateway *tg = media->t38_gateway;
if (!tg)
return;


+ 2
- 2
include/call.h View File

@ -514,7 +514,7 @@ struct call_media {
struct codec_store offered_codecs;
sdp_attr_q generic_attributes; /* sdp_attr_new() */
sdp_attr_q all_attributes; /* sdp_attr_new() */
sdp_attr_print_f *sdp_attr_print;
sdp_media_attr_print_f *sdp_attr_print;
codec_handlers_ht codec_handlers; /* int payload type -> struct codec_handler
XXX combine this with 'codecs' hash table? */
codec_handlers_q codec_handlers_store; /* storage for struct codec_handler */
@ -633,7 +633,7 @@ struct call_monologue {
/* carry `sdp_session` attributes into resulting call monologue SDP */
sdp_attr_q generic_attributes;
sdp_attr_q all_attributes;
sdp_attr_print_f *sdp_attr_print;
sdp_monologue_attr_print_f *sdp_attr_print;
long long moh_db_id;
str moh_blob;


+ 2
- 2
include/sdp.h View File

@ -32,8 +32,8 @@ extern const str rtpe_instance_id;
void sdp_init(void);
sdp_attr_print_f sdp_insert_media_attributes;
sdp_attr_print_f sdp_insert_monologue_attributes;
void sdp_insert_media_attributes(GString *, struct call_media *, const sdp_ng_flags *);
void sdp_insert_monologue_attributes(GString *, struct call_monologue *, const sdp_ng_flags *);
void sdp_append_str_attr(GString *s, const sdp_ng_flags *flags, enum media_type media_type,
const str *name, const char *fmt, ...)


+ 5
- 5
include/types.h View File

@ -13,6 +13,9 @@ typedef struct stream_fd stream_fd;
typedef struct rtp_payload_type rtp_payload_type;
typedef struct sdp_origin sdp_origin;
struct call_monologue;
struct call_media;
struct network_address {
str network_type;
str address_type;
@ -31,11 +34,8 @@ struct sdp_origin {
};
typedef struct sdp_origin sdp_origin;
union sdp_attr_print_arg {
struct call_media *cm;
struct call_monologue *ml;
} __attribute__ ((__transparent_union__));
typedef void sdp_attr_print_f(GString *, union sdp_attr_print_arg, const sdp_ng_flags *flags);
typedef void sdp_monologue_attr_print_f(GString *, struct call_monologue *, const sdp_ng_flags *flags);
typedef void sdp_media_attr_print_f(GString *, struct call_media *, const sdp_ng_flags *flags);
typedef struct ng_parser ng_parser_t;
typedef struct ng_parser_ctx ng_parser_ctx_t;


Loading…
Cancel
Save