Browse Source

TT#30405 rename media->rtp_payload_types to ->codecs for brevity

Change-Id: If89d774a6ab62855118eec74d21123ba61b48e9e
pull/445/head
Richard Fuchs 8 years ago
parent
commit
ca78747c8c
7 changed files with 25 additions and 23 deletions
  1. +9
    -9
      daemon/call.c
  2. +2
    -2
      daemon/call.h
  3. +1
    -0
      daemon/call_interfaces.c
  4. +1
    -1
      daemon/recording.c
  5. +4
    -4
      daemon/redis.c
  6. +7
    -6
      daemon/sdp.c
  7. +1
    -1
      daemon/ssrc.c

+ 9
- 9
daemon/call.c View File

@ -653,7 +653,7 @@ static struct call_media *__get_media(struct call_monologue *ml, GList **it, con
med->call = ml->call;
med->index = sp->index;
call_str_cpy(ml->call, &med->type, &sp->type);
med->rtp_payload_types = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, __payload_type_free);
med->codecs = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, __payload_type_free);
g_queue_push_tail(&ml->medias, med);
@ -950,7 +950,7 @@ void __rtp_stats_update(GHashTable *dst, GHashTable *src) {
struct rtp_payload_type *pt;
GList *values, *l;
/* "src" is a call_media->rtp_payload_types table, while "dst" is a
/* "src" is a call_media->codecs table, while "dst" is a
* packet_stream->rtp_stats table */
values = g_hash_table_get_values(src);
@ -988,7 +988,7 @@ static int __init_streams(struct call_media *A, struct call_media *B, const stru
a->rtp_sink = b;
PS_SET(a, RTP); /* XXX technically not correct, could be udptl too */
__rtp_stats_update(a->rtp_stats, A->rtp_payload_types);
__rtp_stats_update(a->rtp_stats, A->codecs);
if (sp) {
__fill_stream(a, &sp->rtp_endpoint, port_off, sp);
@ -1426,8 +1426,8 @@ static void __rtp_payload_type_add(struct call_media *media, struct rtp_payload_
call_str_cpy(call, &pt->encoding, &pt->encoding);
call_str_cpy(call, &pt->encoding_parameters, &pt->encoding_parameters);
call_str_cpy(call, &pt->format_parameters, &pt->format_parameters);
g_hash_table_replace(media->rtp_payload_types, &pt->payload_type, pt);
g_queue_push_tail(&media->rtp_payload_types_prefs, pt);
g_hash_table_replace(media->codecs, &pt->payload_type, pt);
g_queue_push_tail(&media->codecs_prefs, pt);
}
static void __rtp_payload_types(struct call_media *media, GQueue *types, GHashTable *strip,
@ -1439,7 +1439,7 @@ static void __rtp_payload_types(struct call_media *media, GQueue *types, GHashTa
int remove_all = 0;
// start fresh
g_queue_clear(&media->rtp_payload_types_prefs);
g_queue_clear(&media->codecs_prefs);
if (strip && g_hash_table_lookup(strip, &str_all))
remove_all = 1;
@ -1737,7 +1737,7 @@ const struct rtp_payload_type *__rtp_stats_codec(struct call_media *m) {
if (atomic64_get(&rtp_s->packets) == 0)
goto out;
rtp_pt = rtp_payload_type(rtp_s->payload_type, m->rtp_payload_types);
rtp_pt = rtp_payload_type(rtp_s->payload_type, m->codecs);
out:
g_list_free(values);
@ -2000,8 +2000,8 @@ static void __call_free(void *p) {
crypto_params_cleanup(&md->sdes_out.params);
g_queue_clear(&md->streams);
g_queue_clear(&md->endpoint_maps);
g_hash_table_destroy(md->rtp_payload_types);
g_queue_clear(&md->rtp_payload_types_prefs);
g_hash_table_destroy(md->codecs);
g_queue_clear(&md->codecs_prefs);
g_slice_free1(sizeof(*md), md);
}


+ 2
- 2
daemon/call.h View File

@ -323,8 +323,8 @@ struct call_media {
GQueue streams; /* normally RTP + RTCP */
GQueue endpoint_maps;
GHashTable *rtp_payload_types;
GQueue rtp_payload_types_prefs;
GHashTable *codecs;
GQueue codecs_prefs;
volatile unsigned int media_flags;
};


+ 1
- 0
daemon/call_interfaces.c View File

@ -585,6 +585,7 @@ INLINE int call_ng_flags_prefix(struct sdp_ng_flags *out, str *s_ori, const char
static void call_ng_flags_flags(struct sdp_ng_flags *out, str *s, void *dummy) {
str_hyphenate(s);
// XXX use internal hash tables for these
if (!str_cmp(s, "trust-address"))
out->trust_address = 1;
else if (!str_cmp(s, "SIP-source-address"))


+ 1
- 1
daemon/recording.c View File

@ -730,7 +730,7 @@ static void setup_media_proc(struct call_media *media) {
if (!recording)
return;
GList *pltypes = g_hash_table_get_values(media->rtp_payload_types);
GList *pltypes = g_hash_table_get_values(media->codecs);
for (GList *l = pltypes; l; l = l->next) {
struct rtp_payload_type *pt = l->data;


+ 4
- 4
daemon/redis.c View File

@ -1158,7 +1158,7 @@ static int rbl_cb_plts(str *s, GQueue *q, struct redis_list *list, void *ptr) {
pt->clock_rate = str_to_ui(&clock, 0);
call_str_cpy(call, &pt->encoding_parameters, &enc_parms);
call_str_cpy(call, &pt->format_parameters, &fmt_parms);
g_hash_table_replace(med->rtp_payload_types, &pt->payload_type, pt);
g_hash_table_replace(med->codecs, &pt->payload_type, pt);
return 0;
}
static int json_medias(struct call *c, struct redis_list *medias, JsonReader *root_reader) {
@ -1173,7 +1173,7 @@ static int json_medias(struct call *c, struct redis_list *medias, JsonReader *ro
/* from call.c:__get_media() */
med = uid_slice_alloc0(med, &c->medias);
med->call = c;
med->rtp_payload_types = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
med->codecs = g_hash_table_new_full(g_int_hash, g_int_equal, NULL,
__payload_type_free);
if (redis_hash_get_unsigned(&med->index, rh, "index"))
@ -1318,7 +1318,7 @@ static int json_link_streams(struct call *c, struct redis_list *streams,
return -1;
if (ps->media)
__rtp_stats_update(ps->rtp_stats, ps->media->rtp_payload_types);
__rtp_stats_update(ps->rtp_stats, ps->media->codecs);
}
return 0;
@ -1939,7 +1939,7 @@ char* redis_encode_json(struct call *c) {
}
json_builder_end_array (builder);
k = g_hash_table_get_values(media->rtp_payload_types);
k = g_hash_table_get_values(media->codecs);
snprintf(tmp, sizeof(tmp), "payload_types-%u", media->unique_id);
json_builder_set_member_name(builder, tmp);
json_builder_begin_array (builder);


+ 7
- 6
daemon/sdp.c View File

@ -1348,6 +1348,7 @@ error:
return -1;
}
// XXX iovec can probably be eliminated now and this moved to a regular string builder
struct sdp_chopper *sdp_chopper_new(str *input) {
struct sdp_chopper *c = g_slice_alloc0(sizeof(*c));
c->input = input;
@ -1454,10 +1455,10 @@ static int replace_transport_protocol(struct sdp_chopper *chop,
static int replace_codec_list(struct sdp_chopper *chop,
struct sdp_media *media, struct call_media *cm)
{
if (cm->rtp_payload_types_prefs.length == 0)
if (cm->codecs_prefs.length == 0)
return 0; // legacy protocol or usage error
for (GList *l = cm->rtp_payload_types_prefs.head; l; l = l->next) {
for (GList *l = cm->codecs_prefs.head; l; l = l->next) {
struct rtp_payload_type *pt = l->data;
chopper_append_printf(chop, " %u", pt->payload_type);
}
@ -1702,17 +1703,17 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media *
break;
case ATTR_RTPMAP:
if (media->rtp_payload_types_prefs.length == 0)
if (media->codecs_prefs.length == 0)
break; // legacy protocol or usage error
if (!g_hash_table_lookup(media->rtp_payload_types,
if (!g_hash_table_lookup(media->codecs,
&attr->u.rtpmap.rtp_pt.payload_type))
goto strip;
break;
case ATTR_FMTP:
if (media->rtp_payload_types_prefs.length == 0)
if (media->codecs_prefs.length == 0)
break; // legacy protocol or usage error
if (!g_hash_table_lookup(media->rtp_payload_types,
if (!g_hash_table_lookup(media->codecs,
&attr->u.fmtp.payload_type))
goto strip;
break;


+ 1
- 1
daemon/ssrc.c View File

@ -251,7 +251,7 @@ void ssrc_receiver_report(struct call_media *m, const struct ssrc_receiver_repor
}
}
const struct rtp_payload_type *rpt = rtp_payload_type(pt, m->rtp_payload_types);
const struct rtp_payload_type *rpt = rtp_payload_type(pt, m->codecs);
if (!rpt) {
ilog(LOG_INFO, "Invalid RTP payload type %i, discarding RTCP RR", pt);
goto out_nl;


Loading…
Cancel
Save