mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
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:
parent
13e3918f81
commit
25e58995f5
3 changed files with 25 additions and 3 deletions
|
|
@ -1141,6 +1141,8 @@ static int session_load_source(struct session *session, struct pw_properties *pr
|
|||
if ((str = pw_properties_get(props, "rtp.channels")) != NULL)
|
||||
pw_properties_set(props, "audio.channels", str);
|
||||
}
|
||||
if ((str = pw_properties_get(props, "rtp.ssrc")) != NULL)
|
||||
fprintf(f, "\"rtp.receiver-ssrc\" = \"%s\", ", str);
|
||||
} else {
|
||||
pw_log_error("Unhandled media %s", media);
|
||||
res = -EINVAL;
|
||||
|
|
@ -1267,6 +1269,9 @@ static struct session *session_new(struct impl *impl, struct sdp_info *info)
|
|||
pw_properties_setf(props, "rtp.ts-offset", "%u", info->ts_offset);
|
||||
pw_properties_set(props, "rtp.ts-refclk", info->ts_refclk);
|
||||
|
||||
if (info->ssrc > 0)
|
||||
pw_properties_setf(props, "rtp.ssrc", "%u", info->ssrc);
|
||||
|
||||
if (info->channelmap[0])
|
||||
pw_properties_set(props, PW_KEY_NODE_CHANNELNAMES, info->channelmap);
|
||||
|
||||
|
|
@ -1416,6 +1421,16 @@ static int parse_sdp_a_rtpmap(struct impl *impl, char *c, struct sdp_info *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int parse_sdp_a_ssrc(struct impl *impl, char *c, struct sdp_info *info)
|
||||
{
|
||||
if (!spa_strstartswith(c, "a=ssrc:"))
|
||||
return 0;
|
||||
|
||||
c += strlen("a=ssrc:");
|
||||
spa_atou32(c, &info->ssrc, 10);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int parse_sdp_a_ptime(struct impl *impl, char *c, struct sdp_info *info)
|
||||
{
|
||||
if (!spa_strstartswith(c, "a=ptime:"))
|
||||
|
|
@ -1481,6 +1496,8 @@ static int parse_sdp(struct impl *impl, char *sdp, struct sdp_info *info)
|
|||
res = parse_sdp_m(impl, s, info);
|
||||
else if (spa_strstartswith(s, "a=rtpmap:"))
|
||||
res = parse_sdp_a_rtpmap(impl, s, info);
|
||||
else if (spa_strstartswith(s, "a=ssrc:"))
|
||||
res = parse_sdp_a_ssrc(impl, s, info);
|
||||
else if (spa_strstartswith(s, "a=ptime:"))
|
||||
res = parse_sdp_a_ptime(impl, s, info);
|
||||
else if (spa_strstartswith(s, "a=mediaclk:"))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue