rtp: add option to ignore SSRC

This is useful when there is a fixed receiver and the sender can be
restarted.
This commit is contained in:
Wim Taymans 2023-07-06 12:55:28 +02:00
parent b95ed6dcc1
commit 126e03ec73
4 changed files with 5 additions and 3 deletions

View file

@ -117,7 +117,7 @@ static int rtp_audio_receive(struct impl *impl, uint8_t *buffer, ssize_t len)
if (impl->have_ssrc && impl->ssrc != hdr->ssrc)
goto unexpected_ssrc;
impl->ssrc = hdr->ssrc;
impl->have_ssrc = true;
impl->have_ssrc = !impl->ignore_ssrc;
seq = ntohs(hdr->sequence_number);
if (impl->have_seq && impl->seq != seq) {

View file

@ -293,7 +293,7 @@ static int rtp_midi_receive(struct impl *impl, uint8_t *buffer, ssize_t len)
if (impl->have_ssrc && impl->ssrc != hdr->ssrc)
goto unexpected_ssrc;
impl->ssrc = hdr->ssrc;
impl->have_ssrc = true;
impl->have_ssrc = !impl->ignore_ssrc;
seq = ntohs(hdr->sequence_number);
if (impl->have_seq && impl->seq != seq) {

View file

@ -124,7 +124,7 @@ static int rtp_opus_receive(struct impl *impl, uint8_t *buffer, ssize_t len)
if (impl->have_ssrc && impl->ssrc != hdr->ssrc)
goto unexpected_ssrc;
impl->ssrc = hdr->ssrc;
impl->have_ssrc = true;
impl->have_ssrc = !impl->ignore_ssrc;
seq = ntohs(hdr->sequence_number);
if (impl->have_seq && impl->seq != seq) {

View file

@ -56,6 +56,7 @@ struct impl {
uint32_t ssrc;
uint16_t seq;
unsigned have_ssrc:1;
unsigned ignore_ssrc:1;
unsigned have_seq:1;
uint32_t ts_offset;
uint32_t psamples;
@ -363,6 +364,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
if (pw_properties_get(props, PW_KEY_NODE_NETWORK) == NULL)
pw_properties_set(props, PW_KEY_NODE_NETWORK, "true");
impl->ignore_ssrc = pw_properties_get_bool(props, "sess.ignore-ssrc", false);
impl->direct_timestamp = pw_properties_get_bool(props, "sess.ts-direct", false);
if (direction == PW_DIRECTION_INPUT) {