MT#60476 sdp_create: properly detect usable ps for session

Look for the first usable (non-rejected, non-empty)
media and ps, thereby to determine session-level attributes,
if any. For that to work, it has to have `->selected_sfd`
of the packet stream.

Change-Id: Id4324864571bc78936aa16e235e3866e40860420
mr13.0
Donat Zenichev 2 years ago
parent 5b69e419d5
commit 8933c04be5

@ -3860,20 +3860,29 @@ int sdp_create(str *out, struct call_monologue *monologue, sdp_ng_flags *flags)
const char *err = NULL; const char *err = NULL;
GString *s = NULL; GString *s = NULL;
const struct transport_protocol *prtp; const struct transport_protocol *prtp;
struct call_media *media = NULL;
struct packet_stream *first_ps = NULL;
err = "Need at least one media"; err = "Need at least one media";
if (!monologue->medias->len) if (!monologue->medias->len)
goto err; goto err;
/* look for the first usable (non-rejected, non-empty) media and ps, /* look for the first usable (non-rejected, non-empty) media and ps,
* to determine session-level attributes, if any */ * thereby to determine session-level attributes, if any */
struct call_media *media = monologue->medias->pdata[0]; for (int i = 0; i < monologue->medias->len; i++) {
err = "No media stream"; media = monologue->medias->pdata[i];
if (!media->streams.length) if (!media)
goto err; continue;
struct packet_stream *first_ps = media->streams.head->data; if (!media->streams.head)
err = "No packet stream"; continue;
if (!first_ps->selected_sfd) first_ps = media->streams.head->data;
if (!first_ps->selected_sfd)
continue;
break;
}
err = "No usable packet stream";
if (!first_ps || !first_ps->selected_sfd)
goto err; goto err;
/* init new sdp */ /* init new sdp */

Loading…
Cancel
Save