mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-10-15 12:22:47 +00:00
alsa-plugin: fix delay reporting
The delay should be calculated based on the amount of samples available to the application, not the hardware. This overreported the delay. See #1697
This commit is contained in:
parent
d8e24fca1c
commit
301e729864
|
@ -223,7 +223,7 @@ static int snd_pcm_pipewire_delay(snd_pcm_ioplug_t *io, snd_pcm_sframes_t *delay
|
|||
diff = SPA_TIMESPEC_TO_NSEC(&ts) - pw->time.now;
|
||||
elapsed = (pw->time.rate.denom * diff) / (pw->time.rate.num * SPA_NSEC_PER_SEC);
|
||||
}
|
||||
filled = pw->time.delay + snd_pcm_ioplug_hw_avail(io, pw->hw_ptr, io->appl_ptr);
|
||||
filled = pw->time.delay + snd_pcm_ioplug_avail(io, pw->hw_ptr, io->appl_ptr);
|
||||
|
||||
if (io->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
*delayp = filled - SPA_MIN(elapsed, filled);
|
||||
|
|
Loading…
Reference in a new issue