From b8cdb7e4f9ca188e10c76e150be58a40f7b019a3 Mon Sep 17 00:00:00 2001 From: Martin Geier Date: Mon, 25 Mar 2024 12:32:29 +0100 Subject: [PATCH] module-combine-stream: update latency right before playback starts Combine stream selects the biggest latency from all output streams and sent the latency upstream. To select the biggest latency, each stream needs to have the sample rate and the quantum size set. The combine stream recalculates the latency in the latency changed callback or during data processing. Stream sets the sample rate and the quantum size in a copy_position call which is normally called during processing the output data or when state changes to streaming. Before this change, it wasn't guarantee the copy_position was called for each stream already and latency in the combine stream was selected from random stream. Signed-off-by: Martin Geier --- src/modules/module-combine-stream.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/module-combine-stream.c b/src/modules/module-combine-stream.c index 4afcb8f0b..cbce2d7e9 100644 --- a/src/modules/module-combine-stream.c +++ b/src/modules/module-combine-stream.c @@ -730,6 +730,9 @@ static void stream_state_changed(void *d, enum pw_stream_state old, case PW_STREAM_STATE_UNCONNECTED: stream_destroy(s); break; + case PW_STREAM_STATE_STREAMING: + update_latency(s->impl); + break; default: break; }