pipewire/pipewire-alsa
Martin Geier f5f4be5109 alsa-plugin: improve alsa plugin delay precision if alsa period is not align with the quantum
Method on_stream_process can be called multiple times with the same
pwt.delay and pwt.now values. Its a case, when snd_pcm_pipewire_process
returns less then b->requested frames. For example, if requested is 2048
and alsa period size is 512, then on_stream_process is called 4 times
in a row with the same pwt.delay and pwt.now values.
Store number of transferred frames for this "session" in separate variable
so its incremented each time the on_stream_process is called. Number
of transferred frames is cleared when a new "session" starts.

Introduce also number of buffered frames, which is number of frames
read from alsa but not sent to pipewire yet. This is the case
when period is not align with the quantum size. For example alsa period is
480, but quantum is 512. on_stream_process is called 2 times for the first
quantum, 512 frames is sent to pipewire and 448 frames are cached for the
next round. These 448 frames needs to be included in delay computation
in the next on_stream_process.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2022-10-25 11:32:00 +00:00
..
alsa-plugins alsa-plugin: improve alsa plugin delay precision if alsa period is not align with the quantum 2022-10-25 11:32:00 +00:00
conf alsa: rework parameter handling 2022-09-20 16:24:21 +02:00
tests tests: Add pipewire-alsa stress test 2021-12-15 16:13:08 +01:00