From 13e3918f81b5f677c2be7a06e7f4989d40fb4ecb Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sat, 15 Feb 2025 15:51:06 -0500 Subject: [PATCH] module-rtp-sap: Publish sender SSRC if we have it Can be handy on the receiver side. --- src/modules/module-rtp-sap.c | 8 ++++++++ src/modules/module-rtp/stream.c | 1 + 2 files changed, 9 insertions(+) diff --git a/src/modules/module-rtp-sap.c b/src/modules/module-rtp-sap.c index 2d1111ff0..a5ba80295 100644 --- a/src/modules/module-rtp-sap.c +++ b/src/modules/module-rtp-sap.c @@ -207,6 +207,7 @@ struct sdp_info { float ptime; uint32_t framecount; + uint32_t ssrc; uint32_t ts_offset; char *ts_refclk; }; @@ -732,6 +733,9 @@ static int make_sdp(struct impl *impl, struct session *sess, char *buffer, size_ "a=source-filter: incl IN %s %s %s\n", dst_ip4 ? "IP4" : "IP6", dst_addr, src_addr); + if (sdp->ssrc > 0) + spa_strbuf_append(&buf, "a=ssrc:%u\n", sdp->ssrc); + if (sdp->ptime > 0) spa_strbuf_append(&buf, "a=ptime:%.6g\n", sdp->ptime); @@ -991,6 +995,10 @@ static struct session *session_new_announce(struct impl *impl, struct node *node sdp->rate = atoi(str); if ((str = pw_properties_get(props, "rtp.channels")) != NULL) sdp->channels = atoi(str); + if ((str = pw_properties_get(props, "rtp.ssrc")) != NULL) + sdp->ssrc = atoi(str); + else + sdp->ssrc = 0; if ((str = pw_properties_get(props, "rtp.ts-offset")) != NULL) sdp->ts_offset = atoi(str); str = pw_properties_get(props, "rtp.ts-refclk"); diff --git a/src/modules/module-rtp/stream.c b/src/modules/module-rtp/stream.c index 74da31f74..ca013f773 100644 --- a/src/modules/module-rtp/stream.c +++ b/src/modules/module-rtp/stream.c @@ -547,6 +547,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core, pw_properties_setf(props, "rtp.media", "%s", impl->format_info->media_type); pw_properties_setf(props, "rtp.mime", "%s", impl->format_info->mime); pw_properties_setf(props, "rtp.payload", "%u", impl->payload); + pw_properties_setf(props, "rtp.ssrc", "%u", impl->ssrc); pw_properties_setf(props, "rtp.rate", "%u", impl->rate); if (impl->info.info.raw.channels > 0) pw_properties_setf(props, "rtp.channels", "%u", impl->info.info.raw.channels);