From 533161a766bb5b4af73b2a4937e9266bd87eca06 Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Sat, 16 Dec 2023 19:01:26 +0300 Subject: [PATCH] module-rtp: add framecount to the SDP Required for RAVENNA hardware. Co-authored-by: Dewi Seignard --- src/modules/module-rtp-sap.c | 9 +++++++++ src/modules/module-rtp/stream.c | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/module-rtp-sap.c b/src/modules/module-rtp-sap.c index 133539af8..70b117251 100644 --- a/src/modules/module-rtp-sap.c +++ b/src/modules/module-rtp-sap.c @@ -183,6 +183,7 @@ struct sdp_info { uint32_t channels; float ptime; + uint32_t framecount; uint32_t ts_offset; char *ts_refclk; @@ -568,6 +569,10 @@ static int send_sap(struct impl *impl, struct session *sess, bool bye) spa_strbuf_append(&buf, "a=ptime:%.6g\n", sdp->ptime); + if (sdp->framecount > 0) + spa_strbuf_append(&buf, + "a=framecount:%u\n", sdp->framecount); + if (sdp->ts_refclk != NULL) { spa_strbuf_append(&buf, "a=ts-refclk:%s\n" @@ -691,6 +696,10 @@ static struct session *session_new_announce(struct impl *impl, struct node *node if (!spa_atof(str, &sdp->ptime)) sdp->ptime = 0.0; + if ((str = pw_properties_get(props, "rtp.framecount")) != NULL) + if (!spa_atou32(str, &sdp->framecount)) + sdp->framecount = 0; + if ((str = pw_properties_get(props, "rtp.media")) != NULL) sdp->media_type = strdup(str); if ((str = pw_properties_get(props, "rtp.mime")) != NULL) diff --git a/src/modules/module-rtp/stream.c b/src/modules/module-rtp/stream.c index 3c12bae52..dfe52ffa9 100644 --- a/src/modules/module-rtp/stream.c +++ b/src/modules/module-rtp/stream.c @@ -421,10 +421,13 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core, } else { impl->psamples = impl->mtu / impl->stride; impl->psamples = SPA_CLAMP(impl->psamples, min_samples, max_samples); - if (direction == PW_DIRECTION_INPUT) + if (direction == PW_DIRECTION_INPUT) { pw_properties_set(props, "rtp.ptime", spa_dtoa(tmp, sizeof(tmp), impl->psamples * 1000.0 / impl->rate)); + + pw_properties_setf(props, "rtp.framecount", "%u", impl->psamples); + } } latency_msec = pw_properties_get_uint32(props, "sess.latency.msec", DEFAULT_SESS_LATENCY);