raop: implement retransmission

Keep the last relation between the sequence number and the timestamp
(ringbuffer position).

When a retransmission is requested for a given sequence number use the
relation to calculate the corresponding timestamp and retransmit the
packet from the ringbuffer again.

See #5276
This commit is contained in:
Wim Taymans 2026-05-19 17:30:28 +02:00
parent a6fe6196d5
commit d56d5fa87a
4 changed files with 96 additions and 43 deletions

View file

@ -172,6 +172,7 @@ struct impl {
void (*stop_timer)(struct impl *impl);
void (*flush_timeout)(struct impl *impl, uint64_t expirations);
void (*deinit)(struct impl *impl, enum spa_direction direction);
int (*resend_packets)(struct impl *impl, uint16_t seq, uint16_t num);
/*
* pw_filter where the filter would be driven at the PTP clock
@ -194,6 +195,8 @@ struct impl {
uint64_t rtp_base_ts;
uint32_t rtp_last_ts;
uint64_t last_ts_seq;
/* The process latency, set by on_stream_param_changed(). */
struct spa_process_latency_info process_latency;
};
@ -1059,6 +1062,14 @@ int rtp_stream_receive_packet(struct rtp_stream *s, uint8_t *buffer, size_t len,
struct impl *impl = (struct impl*)s;
return impl->receive_rtp(impl, buffer, len, current_time);
}
int rtp_stream_resend_packets(struct rtp_stream *s, uint16_t seq, uint16_t num)
{
struct impl *impl = (struct impl*)s;
if (impl->resend_packets)
return impl->resend_packets(impl, seq, num);
else
return -ENOTSUP;
}
uint64_t rtp_stream_get_nsec(struct rtp_stream *s)
{