module-rtp-sap: Silently ignore other SSRCs if we know the receiver SSRC

If we know the receiver SSRC from the SAP, we can happily ignore packets
on other SSRCs.
This commit is contained in:
Arun Raghavan 2025-02-15 16:43:06 -05:00
parent 13e3918f81
commit 25e58995f5
3 changed files with 25 additions and 3 deletions

View file

@ -197,8 +197,12 @@ invalid_len:
pw_log_warn("invalid RTP length");
return -EINVAL;
unexpected_ssrc:
pw_log_warn("unexpected SSRC (expected %u != %u)",
impl->ssrc, hdr->ssrc);
if (!impl->fixed_ssrc) {
/* We didn't have a configured SSRC, and there's more than one SSRC on
* this address/port pair */
pw_log_warn("unexpected SSRC (expected %u != %u)", impl->ssrc,
hdr->ssrc);
}
return -EINVAL;
}

View file

@ -64,6 +64,7 @@ struct impl {
uint8_t payload;
uint32_t ssrc;
uint16_t seq;
unsigned fixed_ssrc:1;
unsigned have_ssrc:1;
unsigned ignore_ssrc:1;
unsigned have_seq:1;
@ -436,7 +437,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
impl->ssrc = pw_properties_get_uint32(props, "rtp.sender-ssrc", pw_rand32());
impl->ts_offset = pw_properties_get_uint32(props, "rtp.sender-ts-offset", pw_rand32());
} else {
impl->have_ssrc = pw_properties_fetch_uint32(props, "rtp.receiver-ssrc", &impl->ssrc);
impl->have_ssrc = impl->fixed_ssrc = pw_properties_fetch_uint32(props, "rtp.receiver-ssrc", &impl->ssrc);
if (pw_properties_fetch_uint32(props, "rtp.receiver-ts-offset", &impl->ts_offset) < 0)
impl->direct_timestamp = false;
}