Browse Source

TT#76711 keep track of the raw SDP format string

Change-Id: I7f20dbff3237e39cea700c984a4f41016a2264fc
changes/47/38347/9
Richard Fuchs 6 years ago
parent
commit
a68a59fbf5
4 changed files with 38 additions and 5 deletions
  1. +16
    -5
      daemon/call.c
  2. +4
    -0
      daemon/redis.c
  3. +16
    -0
      daemon/sdp.c
  4. +2
    -0
      include/call.h

+ 16
- 5
daemon/call.c View File

@ -1960,6 +1960,10 @@ int monologue_offer_answer(struct call_monologue *other_ml, GQueue *streams,
MEDIA_SET(media, PTIME_OVERRIDE);
MEDIA_SET(other_media, PTIME_OVERRIDE);
}
if (str_cmp_str(&other_media->format_str, &sp->format_str))
call_str_cpy(call, &other_media->format_str, &sp->format_str);
if (str_cmp_str(&media->format_str, &sp->format_str))
call_str_cpy(call, &media->format_str, &sp->format_str);
codec_rtp_payload_types(media, other_media, &sp->rtp_payload_types, flags);
codec_handlers_update(media, other_media, flags);
@ -2222,17 +2226,24 @@ void call_destroy(struct call *c) {
// stats output only - no cleanups
rtp_pt = __rtp_stats_codec(md);
#define MLL_PREFIX "------ Media #%u ("STR_FORMAT" over %s) using " /* media log line prefix */
#define MLL_COMMON /* common args */ \
md->index, \
STR_FMT(&md->type), \
md->protocol ? md->protocol->name : "(unknown)"
if (!rtp_pt)
ilog(LOG_INFO, MLL_PREFIX "unknown codec", MLL_COMMON);
else
if (md->protocol && md->protocol->rtp) {
rtp_pt = __rtp_stats_codec(md);
if (!rtp_pt)
ilog(LOG_INFO, MLL_PREFIX "unknown codec", MLL_COMMON);
else
ilog(LOG_INFO, MLL_PREFIX STR_FORMAT, MLL_COMMON,
STR_FMT(&rtp_pt->encoding_with_params));
}
else {
ilog(LOG_INFO, MLL_PREFIX STR_FORMAT, MLL_COMMON,
STR_FMT(&rtp_pt->encoding_with_params));
STR_FMT(&md->format_str));
}
for (o = md->streams.head; o; o = o->next) {
ps = o->data;


+ 4
- 0
daemon/redis.c View File

@ -1281,6 +1281,8 @@ static int json_medias(struct call *c, struct redis_list *medias, JsonReader *ro
if (redis_hash_get_str(&s, rh, "type"))
return -1;
call_str_cpy(c, &med->type, &s);
if (!redis_hash_get_str(&s, rh, "format_str"))
call_str_cpy(c, &med->format_str, &s);
if (!redis_hash_get_str(&s, rh, "media_id"))
call_str_cpy(c, &med->media_id, &s);
@ -2034,6 +2036,8 @@ char* redis_encode_json(struct call *c) {
JSON_SET_SIMPLE("tag","%u",media->monologue->unique_id);
JSON_SET_SIMPLE("index","%u",media->index);
JSON_SET_SIMPLE_STR("type",&media->type);
if (media->format_str.s)
JSON_SET_SIMPLE_STR("format_str",&media->format_str);
if (media->media_id.s)
JSON_SET_SIMPLE_STR("media_id",&media->media_id);
JSON_SET_SIMPLE_CSTR("protocol",media->protocol ? media->protocol->name : "");


+ 16
- 0
daemon/sdp.c View File

@ -1268,6 +1268,7 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl
if (attr && attr->value.s)
sp->ptime = str_to_i(&attr->value, 0);
sp->format_str = media->formats;
errstr = "Invalid RTP payload types";
if (__rtp_payload_types(sp, media))
goto error;
@ -1463,9 +1464,24 @@ static int replace_transport_protocol(struct sdp_chopper *chop,
return 0;
}
static int replace_format_str(struct sdp_chopper *chop,
struct sdp_media *media, struct call_media *cm)
{
if (!cm->format_str.s)
return 0;
chopper_append_c(chop, " ");
chopper_append_str(chop, &cm->format_str);
if (skip_over(chop, &media->formats))
return -1;
return 0;
}
static int replace_codec_list(struct sdp_chopper *chop,
struct sdp_media *media, struct call_media *cm)
{
if (cm->protocol && !cm->protocol->rtp)
return replace_format_str(chop, media, cm);
if (cm->codecs_prefs_recv.length == 0)
return 0; // legacy protocol or usage error


+ 2
- 0
include/call.h View File

@ -211,6 +211,7 @@ struct stream_params {
struct endpoint rtcp_endpoint;
unsigned int consecutive_ports;
const struct transport_protocol *protocol;
str format_str;
GQueue sdes_params; // slice-alloc'd
str direction[2];
sockfamily_t *desired_family;
@ -298,6 +299,7 @@ struct call_media {
str type;
enum media_type type_id;
const struct transport_protocol *protocol;
str format_str;
sockfamily_t *desired_family;
const struct logical_intf *logical_intf;


Loading…
Cancel
Save