From e874f705a9264d7b94e011a3cc5e7f080a56ced1 Mon Sep 17 00:00:00 2001 From: Stanislav Ruzani Date: Sat, 27 Dec 2025 18:37:33 +0100 Subject: [PATCH] module-rtp: clear ringbuffer when stream stops to prevent old packets Clear the ringbuffer in stream_stop() when processing stops to prevent old invalid packets from being sent when processing resumes via rtp_audio_flush_packets(). This ensures a clean state when the stream restarts. --- src/modules/module-rtp/stream.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/module-rtp/stream.c b/src/modules/module-rtp/stream.c index e19d88a1f..d69b16524 100644 --- a/src/modules/module-rtp/stream.c +++ b/src/modules/module-rtp/stream.c @@ -454,6 +454,10 @@ static int stream_stop(struct impl *impl) * meaning that the timer was no longer running, and the connection * could be closed. */ if (!timer_running) { + /* Clear the ringbuffer to prevent old invalid packets from being + * sent when processing resumes via rtp_audio_flush_packets() */ + if (impl->reset_ringbuffer) + impl->reset_ringbuffer(impl); set_internal_stream_state(impl, RTP_STREAM_INTERNAL_STATE_STOPPED); pw_log_info("stream stopped"); }