MT#56465 sdp_create(), set the actual sdp timing

Always ensure to set the actual sdp session timing
if given, when creating SDP using `sdp_create()`.
Otherwise just use default value "0 0".

A new dedicated func `sdp_out_add_timing()` introduced
for that.

Change-Id: Ic02e1a1f55e21b85e50793e1608978ca0951c49d
pull/1838/head
Donat Zenichev 1 year ago
parent 611469eca0
commit 4f944502a5

@ -2657,6 +2657,10 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, sdp_ng_f
ml->sdp_session_name = call_strdup_len(call, flags->session_sdp_name.s,
flags->session_sdp_name.len);
}
/* sdp session timing */
if (flags->session_timing.len)
ml->sdp_session_timing = call_strdup_len(call, flags->session_timing.s,
flags->session_timing.len);
/* sdp bandwidth per session level
* 0 value is supported (e.g. b=RR:0 and b=RS:0), to be able to disable rtcp */
if (flags->session_rr >= 0)

@ -1815,6 +1815,7 @@ int sdp_streams(const sdp_sessions_q *sessions, sdp_streams_q *streams, sdp_ng_f
flags->session_sdp_name = session->session_name;
flags->session_rr = session->rr;
flags->session_rs = session->rs;
flags->session_timing = session->session_timing;
for (__auto_type k = session->media_streams.head; k; k = k->next) {
media = k->data;
@ -3457,6 +3458,18 @@ static void sdp_out_add_session_name(GString *out, struct call_monologue *monolo
g_string_append_printf(out, "s=%s\r\n", sdp_session_name);
}
static void sdp_out_add_timing(GString *out, struct call_monologue *monologue)
{
const char * sdp_session_timing = "0 0"; /* default */
struct media_subscription *ms = call_get_top_media_subscription(monologue);
if (ms && ms->monologue && ms->monologue->sdp_session_timing)
sdp_session_timing = ms->monologue->sdp_session_timing;
/* sdp timing per session level */
g_string_append_printf(out, "t=%s\r\n", sdp_session_timing);
}
static void sdp_out_add_bandwidth(GString *out, struct call_monologue *monologue,
struct stream_params *sp, struct call_media *media)
{
@ -3552,7 +3565,7 @@ int sdp_create(str *out, struct call_monologue *monologue,
sdp_out_add_bandwidth(s, monologue, NULL, NULL);
/* set timing to always be: 0 0 */
g_string_append(s, "t=0 0\r\n");
sdp_out_add_timing(s, monologue);
monologue->sdp_attr_print(s, monologue, flags);

@ -610,6 +610,7 @@ struct call_monologue {
GString *last_out_sdp;
char *sdp_username;
char *sdp_session_name;
char *sdp_session_timing;
struct ssrc_hash *ssrc_hash;
str metadata;
struct janus_session *janus_session;

@ -73,6 +73,7 @@ struct sdp_ng_flags {
sdp_attr_q session_attributes; // top-level (not part of an m= section) SDP session attributes
struct sdp_origin session_sdp_orig;
str session_sdp_name;
str session_timing; /* t= line */
int session_rr, session_rs; /* b= bandwidth per session level */
/* commands to manipulate attr lines in SDP */

Loading…
Cancel
Save