diff --git a/src/modules/module-rtp-sap.c b/src/modules/module-rtp-sap.c index e49884d83..dbcadbbc0 100644 --- a/src/modules/module-rtp-sap.c +++ b/src/modules/module-rtp-sap.c @@ -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);