combine-sink: Fix latency reports

The combine sink used the current time and counter when calculating
the latency if smoother_2 was enabled. This lead to wrong latency
reports. This patch fixes the problem by using the snapshot time
and counter instead.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/711>
This commit is contained in:
Georg Chini 2022-05-27 11:43:15 +02:00 committed by PulseAudio Marge Bot
parent 2af10cf39b
commit d146a8079b

View file

@ -1072,7 +1072,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
size_t latency;
latency = pa_usec_to_bytes((pa_usec_t)offset, &u->sink->sample_spec);
pa_smoother_2_put(u->thread_info.smoother, pa_rtclock_now(), (int64_t)u->thread_info.counter - latency);
pa_smoother_2_put(u->thread_info.smoother, u->thread_info.snapshot_time, (int64_t)u->thread_info.snapshot_counter - latency);
#else
pa_usec_t x, y, latency = (pa_usec_t) offset;