linux-stable/sound
Alexander Tsoy f0bd62b640 ALSA: usb-audio: Improve frames size computation
For computation of the the next frame size current value of fs/fps and
accumulated fractional parts of fs/fps are used, where values are stored
in Q16.16 format. This is quite natural for computing frame size for
asynchronous endpoints driven by explicit feedback, since in this case
fs/fps is a value provided by the feedback endpoint and it's already in
the Q format. If an error is accumulated over time, the device can
adjust fs/fps value to prevent buffer overruns/underruns.

But for synchronous endpoints the accuracy provided by these computations
is not enough. Due to accumulated error the driver periodically produces
frames with incorrect size (+/- 1 audio sample).

This patch fixes this issue by implementing a different algorithm for
frame size computation. It is based on accumulating of the remainders
from division fs/fps and it doesn't accumulate errors over time. This
new method is enabled for synchronous and adaptive playback endpoints.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200424022449.14972-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-04-24 08:25:24 +02:00
..
ac97 ALSA: ac97: Constify snd_ac97_bus_ops definitions 2020-01-03 09:24:11 +01:00
aoa ALSA: aoa: More constifications 2020-01-05 16:14:27 +01:00
arm ASoC: arm: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer 2020-03-27 14:44:56 +00:00
atmel ALSA: atmel: Constify snd_ac97_bus_ops definitions 2020-01-03 09:24:12 +01:00
core sound fixes for 5.7-rc1 2020-04-10 12:27:06 -07:00
drivers ALSA: dummy: Use standard macros for fixing PCM format cast 2020-02-10 08:27:31 +01:00
firewire ALSA: firewire-tascam: Add missing annotation for tscm_hwdep_read_locked() 2020-03-11 07:55:38 +01:00
hda Merge branch 'topic/nhlt' into for-next 2020-04-24 08:22:55 +02:00
i2c ALSA: i2c: Constify snd_kcontrol_new items 2020-01-03 09:24:24 +01:00
isa ALSA: Fix misspellings of "Analog Devices" 2020-04-17 11:38:03 +02:00
mips ALSA: sgio2audio: Remove usage of dropped hw_params/hw_free functions 2020-03-06 12:06:41 +01:00
oss .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
parisc sound updates for 5.6-rc1 2020-01-28 16:26:57 -08:00
pci Merge branch 'for-linus' into for-next 2020-04-24 08:24:44 +02:00
pcmcia ALSA: pdaudiocf: More constification 2020-01-05 16:15:13 +01:00
ppc ALSA: ppc: keywest: convert to use i2c_new_client_device() 2020-03-27 09:33:01 +01:00
sh ALSA: sh: Fix compile warning wrt const 2020-01-05 16:15:14 +01:00
soc Merge branch 'for-linus' into for-next 2020-04-24 08:24:44 +02:00
sparc ALSA: sparc: More constifications 2020-01-05 16:14:56 +01:00
spi ALSA: spi: More constification 2020-01-05 16:15:13 +01:00
synth ALSA: emux: More constifications 2020-01-05 16:14:46 +01:00
usb ALSA: usb-audio: Improve frames size computation 2020-04-24 08:25:24 +02:00
x86 sound updates for 5.6-rc1 2020-01-28 16:26:57 -08:00
xen ALSA: xen: Drop superfluous ioctl PCM ops 2019-12-11 07:25:35 +01:00
ac97_bus.c ALSA: ac97: Treat snd_ac97_bus_ops as const 2020-01-03 09:24:08 +01:00
Kconfig
last.c
Makefile
sound_core.c