Commit graph

4153 commits

Author SHA1 Message Date
Jaroslav Kysela
437b5b3aae ucm: fix possible memory leak in parse_verb_file()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-07 17:32:11 +01:00
Jaroslav Kysela
b62f66442b pcm: rate - fix the capture delay values
Use the correct snd_pcm_mmap_capture_delay() function instead
snd_pcm_mmap_capture_hw_avail().

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 17:27:37 +01:00
Jaroslav Kysela
ac520b2ed1 pcm: rate - use pcm_frame_diff() on related places
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 17:14:42 +01:00
Jaroslav Kysela
da5b70d3fa pcm: plugin - fix status code for capture
The recent updates do not take in account the possible
calls for the capture stream. Fix the avail and delay
inconsistencies (and assert).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 12:32:27 +01:00
Jaroslav Kysela
fc0f7af9ee pcm: rate - use pcm_frame_diff() in snd_pcm_rate_playback_internal_delay()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-04 12:31:52 +01:00
Jaroslav Kysela
6cee452eab pcm: ioplug - fix the delay calculation for old plugins
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:16:11 +01:00
Jaroslav Kysela
5988bb3ff4 pcm: rate - tidy up snd_pcm_rate_avail_update()
No functional change - just move the capture code to
a separate function for the better readability.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:16:11 +01:00
Jaroslav Kysela
6ca01c07ee pcm: ioplug - fix the delay calculation in the status callback
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 17:15:53 +01:00
Jaroslav Kysela
21549e6583 Revert "pcm_plugin: fix delay"
This reverts commit aba87e5098.

The commit does not look good. The plugins must handle
the delay value correctly.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:43:30 +01:00
Jaroslav Kysela
28cc099d9e pcm: plugin - optimize sync in snd_pcm_plugin_status()
Do hw_ptr sync only once after the status call. This avoids
double update.

Also, the application pointer must not change when
the status is called. Add assert() call for this condition.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:41:32 +01:00
Jaroslav Kysela
fa1895aa2b pcm: plugin - tidy snd_pcm_plugin_avail_update()
No functional changes - move the code to snd_pcm_plugin_sync_hw_ptr()
and put the mmap capture updates to separate function for readability.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:34:07 +01:00
Jaroslav Kysela
49eea5d7bc pcm: plugin status - revert the recent changes
It's no reason to sync the avail/delay fields using the mirrored
buffer pointers. The slave information must be valid.

The original report probably tries to fix something for
the specific plugin. Revert all changes.

Fixes: afe6ff3b33 ("pcm: plugin status - fix the return value (regression)")
Fixes: 4f90392f07 ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2021-01-03 16:16:44 +01:00
Jaroslav Kysela
afe6ff3b33 pcm: plugin status - fix the return value (regression)
The snd_pcm_plugin_avail_update() error code in snd_pcm_plugin_status()
should not be reported to the caller. The state errors can be determined
using the state member in the status structure.

Fixes: 4f90392f07 ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
BugLink: https://github.com/alsa-project/alsa-lib/issues/107
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-30 09:38:04 +01:00
Jaroslav Kysela
6c24cd2e60 conf: fix return code in _snd_config_load_with_include
Fixes: 5275d170e0 ("conf: fix use after free in _snd_config_load_with_include")
BugLink: https://github.com/alsa-project/alsa-lib/issues/108
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-29 11:17:58 +01:00
Alex Henrie
a92ad2fea4 confmisc: fix memory leak in snd_func_concat
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-29 09:23:07 +01:00
Jaroslav Kysela
36aff79747 pcm: fix __snd_pcm_state() return value
The __snd_pcm_state() must return a valid state, not an error value
when the plugin callback is not defined. Use the first state
SND_PCM_STATE_OPEN - the other functions will return the error
code depending on this state.

Link: https://lore.kernel.org/alsa-devel/20201226213547.175071-10-alexhenrie24@gmail.com/
Reported-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-27 13:31:57 +01:00
Jaroslav Kysela
9ebd29d2d3 conf: fix get_hexachar() return value
Reported-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-12-27 13:17:48 +01:00
Alex Henrie
fc719bfe4e pcm_multi: remove dead assignment from _snd_pcm_multi_open
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:28:24 +01:00
Alex Henrie
2e470d59d8 pcm: remove dead assignments from snd_pcm_rate_(commit_area|grab_next_period)
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:27:26 +01:00
Alex Henrie
aa28847248 timer: fix sizeof operator mismatch in snd_timer_query_hw_open
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:27:04 +01:00
Alex Henrie
c56278cfda rawmidi: fix memory leak in snd_rawmidi_virtual_open
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:23:20 +01:00
Alex Henrie
0f4821ec17 ucm: fix bad frees in get_list0 and get_list20
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:21:55 +01:00
Alex Henrie
5275d170e0 conf: fix use after free in _snd_config_load_with_include
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-27 09:20:38 +01:00
Takashi Iwai
a9cbfecd87 pcm: Fix a typo in SND_PCM_AUDIO_TSTAMP_TYPE_LAST definition
It was wrongly defined with SNDRV_ prefix.  Fix it.

Fixes: ea02dbd20a ("pcm: Add snd_pcm_audio_tstamp_type_t constants")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-22 16:11:05 +01:00
David Henningsson
dcda999d00 test/audio_time: Make use of SND_PCM_AUDIO_TSTAMP_TYPE constants
Also fixup the usage row which seemed wrong to me.

Signed-off-by: David Henningsson <diwic@ubuntu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-17 11:26:15 +01:00
David Henningsson
ea02dbd20a pcm: Add snd_pcm_audio_tstamp_type_t constants
These are mostly a copy-paste from the kernel headers. But since functions
snd_pcm_audio_tstamp_config make use of these they should be added to the
public API as well.

Reported-by: Alex Moon <alex.r.moon@gmail.com>
Signed-off-by: David Henningsson <diwic@ubuntu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-17 11:25:57 +01:00
Takashi Iwai
6d3311fefb Makefile: Add README.md to EXTRA_DIST
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-10 10:37:13 +01:00
Jonas Holmberg
7d36895225 pcm: set the snd_pcm_ioplug_status() tstamp field
Set the status tstamp field so that it can be accessed with
snd_pcm_status_get_htstamp().

Signed-off-by: Jonas Holmberg <jonashg@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-12-02 15:29:26 +01:00
Pierre-Louis Bossart
e5c350d7bc topology: use inclusive language in documentation
Use codec_provider and codec_consumer for bclk and fsync

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-11-17 14:01:30 +01:00
Pierre-Louis Bossart
706192341d topology: use inclusive language for fsync
use fsync_provider for structure fields, 'codec_provider' and
'codec_consumer' for options and modify #defines to use CP and CC
suffixes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-11-17 14:01:20 +01:00
Pierre-Louis Bossart
39bd0e1a5b topology: use inclusive language for bclk
use bclk_provider for structure fields, 'codec_provider' and
'codec_consumer' for options and modify #defines to use CP and CC
suffixes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-11-17 13:59:18 +01:00
Jaroslav Kysela
2757191e3b pcm: snd_pcm_mmap_readi - fix typo in comment
\param size frames to be *read*

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-29 20:34:25 +01:00
Jaroslav Kysela
1d993b37ab dlmisc: fix snd_plugin_dir locking for not DL_ORIGIN_AVAILABLE
Fixes: 8580c081c2 ("dlsym: add support for ALSA_PLUGIN_DIR environment variable")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-29 20:32:10 +01:00
Jaroslav Kysela
ad8c8e5503 dlmisc: the snd_plugin_dir_set / snd_plugin_dir must be declared even for \!DL_ORIGIN_AVAILABLE
Fixes: 8580c081c2 ("dlsym: add support for ALSA_PLUGIN_DIR environment variable")
BugLink: https://github.com/alsa-project/alsa-lib/issues/91
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-22 20:58:19 +02:00
Jaroslav Kysela
49bd4b198e Release v1.2.4
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-19 11:45:13 +02:00
Jaroslav Kysela
e91b1c0670 topology: straight printf and error path fixes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-19 11:17:21 +02:00
Jaroslav Kysela
5c1cb568ec topology: save_config - fix the error path handling
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-19 11:02:29 +02:00
Jaroslav Kysela
d77fb47318 ucm: handle correctly Linked configuration
BugLink: https://github.com/alsa-project/alsa-ucm-conf/issues/54
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-19 10:52:13 +02:00
Jaroslav Kysela
cebe0fe0f9 tplg: fix the unaligned_get32/put32 helpers for big endian
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-15 19:13:18 +02:00
Jaroslav Kysela
e191b231c5 pcm: file plugin - implement safe_write
The syscalls may return EINTR when a signal is handled.
Implement safe_write() function which does simple write
retry.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-15 12:54:29 +02:00
Jaroslav Kysela
0128af6f54 pcm: fix the pcm_frames_diff -> pcm_frame_diff typo
BugLink: https://github.com/alsa-project/alsa-lib/issues/85
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-14 17:55:20 +02:00
Jaroslav Kysela
ebe2f8b851 pcm: dshare - apply the boundary wrap in snd_pcm_dshare_sync_area()
BugLink: https://github.com/alsa-project/alsa-lib/issues/84
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-13 20:15:09 +02:00
Jaroslav Kysela
6d06fcc285 pcm: introduce pcm_frame_diff and pcm_frame_diff2 helpers
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-13 20:10:49 +02:00
Jaroslav Kysela
a6c8ac0c85 pcm: meter / s16 - add protection for the maximum copied frames
The rewind or forward may cause the stream pointer change. Although
this patch does not fix the real meter update issue, it breaks
the possible big loops when the stream pointers are desynced with
the meters. It does not make sense to copy more samples than the
pcm buffer contains.

Link: https://lore.kernel.org/alsa-devel/f56d6a67-014a-e562-c253-830c0ec03717@ivitera.com/
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-13 19:31:49 +02:00
Jaroslav Kysela
aa89ad9362 dlsym: use the only alsa plugins directory for the internal modules
The commit b2a4272ecb introduced a slightly
different behaviour for ALSA_PLUGIN_DIR. The fallback causes that the
alsa libraries are searched in all library directories.

It was never intended to do the system wide library lookups for
internal modules.

Fixes: b2a4272ecb ("snd_dlopen: do not use absolute plugin path for snd_dlopen() calls")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-13 17:00:29 +02:00
Jaroslav Kysela
2a204a5412 dlmisc, pcm: export the old symbols (for -flto)
All old symbols must be visible (exported) for -flto.

BugLink: https://github.com/alsa-project/alsa-lib/issues/56
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-13 11:33:29 +02:00
Jaroslav Kysela
8580c081c2 dlsym: add support for ALSA_PLUGIN_DIR environment variable
In some cases, it may be useful to specify the plugin directory
using the environment variable.

BugLink: https://github.com/alsa-project/alsa-lib/issues/82
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-13 10:43:46 +02:00
Jaroslav Kysela
4f90392f07 pcm: fix the snd_pcm_plugin_status() avail and delay fields
The avail and delay fields in the returned status structure does not
reflect the actual hw_ptr/appl_ptr. This change correct this.

TODO: Unfortunately, the delay might contain also information about
extra hardware / buffering delay which is hidden with this change.

Link: https://lore.kernel.org/alsa-devel/d9c1f37e-5c8d-f289-270e-c6cda7a56ce3@axis.com/
Reported-by: Jonas Holmberg <jonashg@axis.com>
Tested-by: Jonas Holmberg <jonashg@axis.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-09 20:02:22 +02:00
Jaroslav Kysela
2b217b7010 ucm: rename once_list to boot_list
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 10:47:11 +02:00
Jaroslav Kysela
61749cf400 ucm: substitute the comment string also in the main configuration file
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-10-06 10:43:38 +02:00