alsa-lib/src
Timo Wischer b420056604 pcm: interval: Interpret (x x+1] correctly and return x+1
Without this change an interval of (x x+1] will be interpreted as an
empty interval but the right value would be x+1.
This leads to a failing snd_pcm_hw_params() call which returns -EINVAL.

An example issue log is given in the following:
snd_pcm_hw_params failed with err -22 (Invalid argument)
ACCESS: MMAP_NONINTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 16
CHANNELS: 1
RATE: 16000
PERIOD_TIME: (15999 16000]
PERIOD_SIZE: (255 256]
PERIOD_BYTES: (510 512]
PERIODS: [2 3)
BUFFER_TIME: 32000
BUFFER_SIZE: 512
BUFFER_BYTES: 1024

In case of (x x+1) we have to interpret it anyway as a single value of x to
compensate rounding issues.
For example the period size will result in an interval of (352 353) when
the period time is 16ms and the sample rate 22050 Hz
(16ms * 22,05 kHz = 352,8 frames). But 352 has to be chosen to allow a
buffer size of 705 (32ms * 22,05 kHz = 705,6 frames) which has to be >= 2x
period size to avoid Xruns. The buffer size will not end up with an
interval of (705 706) simular to the period size because
snd_pcm_rate_hw_refine_cchange() calls snd_interval_floor() for the buffer
size. Therefore this value will be interpreted as an integer interval
instead of a real interval further on.

This issue seems to exist since the change of 9bb985c38 ("pcm:
snd_interval_refine_first/last: exclude value only if also excluded
before")

Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2018-10-24 12:07:33 +02:00
..
alisp control: Proper reference of internal versioned functions 2018-01-04 15:28:25 +01:00
conf conf/ucm/Dell-WD15-Dock: Fix incorrect device names 2018-10-18 09:38:38 +02:00
control control_hw: Fix issue when applying seccomp policy 2018-08-19 10:08:49 +02:00
hwdep core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
mixer core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
pcm pcm: interval: Interpret (x x+1] correctly and return x+1 2018-10-24 12:07:33 +02:00
rawmidi core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
seq seq: Fix signedness in MIDI encoder/decoder 2018-08-23 08:34:37 +02:00
timer core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
topology ASoC: topology: Add alias conf parameter names for hw_configs 2018-04-20 09:27:44 +02:00
ucm ucm: adding the folder of card_long_name when finding verb conf file 2018-05-02 08:42:40 +02:00
async.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
conf.c core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
confmisc.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
dlmisc.c core: Proper reference of internal snd_dlopen() 2018-01-04 15:29:57 +01:00
error.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
input.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
Makefile.am topology: autotools: Add build support for topology core 2015-07-30 17:10:14 +02:00
names.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
output.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
shmarea.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
socket.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
userfile.c Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
Versions.in Change snd_dlopen() function to return the error string 2017-11-27 21:48:20 +01:00