mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-15 08:56:38 -05: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
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
diff = SPA_TIMESPEC_TO_NSEC(&ts) - pw->time.now;
|
||||||
elapsed = (pw->time.rate.denom * diff) / (pw->time.rate.num * SPA_NSEC_PER_SEC);
|
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)
|
if (io->stream == SND_PCM_STREAM_PLAYBACK)
|
||||||
*delayp = filled - SPA_MIN(elapsed, filled);
|
*delayp = filled - SPA_MIN(elapsed, filled);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue