From fee6c2b5d1a46f20e5133133c040552c073afda1 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 25 Jun 2024 09:39:04 +0200 Subject: [PATCH] MT#56465 sdp_parse: add support of `b=AS:` As the standard assumes, that the bandwidth can be also controlled per media, it makes sense to support it, so introduce `b=AS:` attr parsing. Change-Id: Id4b344c10bbd45b1f3ba14a882d58072a4e43c68 --- daemon/sdp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index 036a33e60..d93b678cb 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -124,7 +124,7 @@ struct sdp_media { struct sdp_connection connection; const char *c_line_pos; - int rr, rs; + int as, rr, rs; struct sdp_attributes attributes; GQueue format_list; /* list of slice-alloc'd str objects */ enum media_type media_type_id; @@ -1325,7 +1325,7 @@ new_session: goto error; t_queue_push_tail(&session->media_streams, media); media->s.s = b; - media->rr = media->rs = -1; + media->rr = media->rs = media->as = -1; media->media_sdp_id = media_sdp_id++; break; @@ -1366,7 +1366,10 @@ new_session: /* RR:0 */ if (line_end - value < 4) break; - if (!memcmp(value, "RR:", 3)) + /* AS only supported per media */ + if (media && !memcmp(value, "AS:", 3)) + *(&media->as) = (line_end - value == 4 && value[3] == '0') ? 0 : 1; + else if (!memcmp(value, "RR:", 3)) *(media ? &media->rr : &session->rr) = (line_end - value == 4 && value[3] == '0') ? 0 : 1; else if (!memcmp(value, "RS:", 3))