From 023e9c54bf4ba3ac56375c817b21b760f923ad17 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 25 Jun 2024 08:40:59 +0200 Subject: [PATCH] MT#56465 sdp_create: add code commentaries Just adding some code commentaries. No functional change. Change-Id: I1b9b37746db0683cbd97fc00bd36ded93aef7f6b --- daemon/sdp.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index aa247d4eb..036a33e60 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -3509,6 +3509,7 @@ int sdp_create(str *out, struct call_monologue *monologue, monologue->sdp_attr_print(s, monologue, flags); + /* print media sections */ for (unsigned int i = 0; i < monologue->medias->len; i++) { media = monologue->medias->pdata[i]; @@ -3518,17 +3519,25 @@ int sdp_create(str *out, struct call_monologue *monologue, if (streams) sp = t_queue_peek_nth(streams, i); + /* check call media existence */ err = "Empty media stream"; if (!media) continue; + + /* check streams existence */ err = "Zero length media stream"; if (!media->streams.length) goto err; + __auto_type rtp_ps_link = media->streams.head; struct packet_stream *rtp_ps = rtp_ps_link->data; + + /* check socket file descriptor */ err = "No selected FD"; if (!rtp_ps->selected_sfd) goto err; + + /* set: media type, port, protocol (e.g. RTP/SAVP) */ err = "Unknown media protocol"; if (media->protocol) g_string_append_printf(s, "m=" STR_FORMAT " %i %s ", @@ -3542,12 +3551,12 @@ int sdp_create(str *out, struct call_monologue *monologue, STR_FMT(&media->protocol_str)); else goto err; - print_codec_list(s, media); - /* after codecs added, add newline */ + /* print codecs and add newline */ + print_codec_list(s, media); g_string_append_printf(s, "\r\n"); - /* add an actual media connection */ + /* add actual media connection */ sdp_out_add_media_connection(s, media, rtp_ps, sp, flags); /* print media level attributes */