1
Fork 0

module-rtp-sap: refactor channelmap generation

This commit is contained in:
Dmitry Sharshakov 2023-12-20 12:19:03 +03:00 committed by Wim Taymans
parent aca4d93b31
commit a7410fe1bf
1 changed files with 5 additions and 3 deletions

View File

@ -740,6 +740,9 @@ static struct session *session_new_announce(struct impl *impl, struct node *node
if ((str = pw_properties_get(props, "rtp.ts-refclk")) != NULL)
sdp->ts_refclk = strdup(str);
if ((str = pw_properties_get(props, PW_KEY_NODE_CHANNELNAMES)) != NULL) {
struct spa_strbuf buf;
spa_strbuf_init(&buf, sdp->channelmap, sizeof(sdp->channelmap));
struct spa_json it[2];
char v[256];
@ -748,10 +751,9 @@ static struct session *session_new_announce(struct impl *impl, struct node *node
spa_json_init(&it[1], str, strlen(str));
if (spa_json_get_string(&it[1], v, sizeof(v)) > 0)
snprintf(sdp->channelmap, sizeof(sdp->channelmap) - 1, "%s", v);
spa_strbuf_append(&buf, "%s", v);
while (spa_json_get_string(&it[1], v, sizeof(v)) > 0)
snprintf(sdp->channelmap + strlen(sdp->channelmap),
sizeof(sdp->channelmap) - strlen(sdp->channelmap) - 1, ", %s", v);
spa_strbuf_append(&buf, ", %s", v);
}
pw_log_info("created new session for node:%u", node->id);