alsa-sink: update max_rewind when updating the latency
authorTanu Kaskinen <tanuk@iki.fi>
Tue, 31 Oct 2017 13:29:25 +0000 (15:29 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Sun, 5 Nov 2017 13:22:17 +0000 (15:22 +0200)
commit83e12c43b110fc45056b625ea005b96d231dd415
tree6811e608ace355bcd1396b80fecef42ba6de7748
parent3c45897d2064c90c3f3ef2edfbdd3c1cfd1147a3
alsa-sink: update max_rewind when updating the latency

Previously max_rewind was always set to the full hw buffer size, but
the actual maximum rewind amount is limited to the part of the hw buffer
that is in use.

The rewind request that was done when lowering the sink latency had to
be moved to happen before updating max_rewind.

The practical benefit of this change: When using a filter source on a
monitor source, the filter source latency is increased by max_rewind.
Without this change the max_rewind of an alsa sink is often
unnecessarily high, which leads to unnecessarily high latency with
filter sources.

Monitor sources themselves don't suffer from the latency issue, because
they use the current sink latency instead of max_rewind for the extra
buffer that they keep to deal with rewinds.
src/modules/alsa/alsa-sink.c