Browse Source

MT#58535 Use `call_ng_flags_flags()` for generic flags

During the parsing of `rtpp_flags` use the
`call_ng_flags_flags()` directly instead of the
`bencode_list_add_str()`, hence reduce amount
of iterations required to parse generic flags.

Additionally:

`call_ng_flags_flags()` is made visible for usage
within external files.

`helper_arg` union has been moved to the header.

Change-Id: I34399a0d3940a1276feb1210e4421cbcdf656e9d
pull/1809/head
Donat Zenichev 2 years ago
parent
commit
282f57884e
3 changed files with 13 additions and 10 deletions
  1. +1
    -9
      daemon/call_interfaces.c
  2. +1
    -1
      daemon/control_ng_flags_parser.c
  3. +11
    -0
      include/call_interfaces.h

+ 1
- 9
daemon/call_interfaces.c View File

@ -32,14 +32,6 @@
#include "dtmf.h" #include "dtmf.h"
#include "control_ng_flags_parser.h" #include "control_ng_flags_parser.h"
typedef union {
const struct sdp_attr_helper *attr_helper;
str_q *q;
str_case_ht *sct;
str_case_value_ht *svt;
void **generic;
} helper_arg __attribute__ ((__transparent_union__));
static pcre2_code *info_re; static pcre2_code *info_re;
static pcre2_code *streams_re; static pcre2_code *streams_re;
@ -988,7 +980,7 @@ INLINE int call_ng_flags_prefix(sdp_ng_flags *out, str *s_ori, const char *prefi
cb(out, &s, arg); cb(out, &s, arg);
return 1; return 1;
} }
static void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy) {
void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy) {
str_hyphenate(s); str_hyphenate(s);
switch (__csh_lookup(s)) { switch (__csh_lookup(s)) {


+ 1
- 1
daemon/control_ng_flags_parser.c View File

@ -456,7 +456,7 @@ void parse_rtpp_flags(const str * rtpp_flags, bencode_item_t * root_dict,
generic: generic:
/* generic one key flags */ /* generic one key flags */
if (!val.s) if (!val.s)
bencode_list_add_str(flags, &key);
call_ng_flags_flags(out, &key, NULL);
/* generic flags with value, but no particular processing */ /* generic flags with value, but no particular processing */
else else
bencode_dictionary_str_add_str(root_dict, &key, &val); bencode_dictionary_str_add_str(root_dict, &key, &val);


+ 11
- 0
include/call_interfaces.h View File

@ -14,6 +14,14 @@ struct call_stats;
struct streambuf_stream; struct streambuf_stream;
struct sockaddr_in6; struct sockaddr_in6;
typedef union {
const struct sdp_attr_helper *attr_helper;
str_q *q;
str_case_ht *sct;
str_case_value_ht *svt;
void **generic;
} helper_arg __attribute__ ((__transparent_union__));
struct sdp_ng_flags { struct sdp_ng_flags {
enum call_opmode opmode; enum call_opmode opmode;
enum message_type message_type; enum message_type message_type;
@ -278,6 +286,8 @@ int call_interfaces_init(void);
void call_interfaces_free(void); void call_interfaces_free(void);
void call_interfaces_timer(void); void call_interfaces_timer(void);
void call_ng_flags_flags(sdp_ng_flags *out, str *s, helper_arg dummy);
INLINE struct sdp_manipulations *sdp_manipulations_get_by_id(const sdp_ng_flags *f, enum media_type id) { INLINE struct sdp_manipulations *sdp_manipulations_get_by_id(const sdp_ng_flags *f, enum media_type id) {
if (id < 0 || id >= G_N_ELEMENTS(f->sdp_manipulations)) if (id < 0 || id >= G_N_ELEMENTS(f->sdp_manipulations))
return NULL; return NULL;
@ -300,4 +310,5 @@ INLINE struct sdp_manipulations *sdp_manipulations_get_by_name(sdp_ng_flags *f,
} }
#endif #endif

Loading…
Cancel
Save