Accepting request 860488 from multimedia:libs
OBS-URL: https://build.opensuse.org/request/show/860488 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa?expand=0&rev=207
This commit is contained in:
commit
18c2982a72
@ -0,0 +1,32 @@
|
||||
From ad8c8e5503980295dd8e5e54a6285d2d7e32eb1e Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Thu, 22 Oct 2020 20:57:32 +0200
|
||||
Subject: [PATCH 01/33] 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>
|
||||
---
|
||||
src/dlmisc.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/src/dlmisc.c b/src/dlmisc.c
|
||||
index c9517c5519a1..f20eb59373cf 100644
|
||||
--- a/src/dlmisc.c
|
||||
+++ b/src/dlmisc.c
|
||||
@@ -42,11 +42,9 @@
|
||||
#ifndef PIC
|
||||
struct snd_dlsym_link *snd_dlsym_start = NULL;
|
||||
#endif
|
||||
-#ifdef DL_ORIGIN_AVAILABLE
|
||||
static int snd_plugin_dir_set = 0;
|
||||
static char *snd_plugin_dir = NULL;
|
||||
#endif
|
||||
-#endif
|
||||
|
||||
#if defined(DL_ORIGIN_AVAILABLE) && defined(HAVE_LIBPTHREAD)
|
||||
static pthread_mutex_t snd_dlpath_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 1d993b37ab4e0b9b6e6b795d7be84ce97b29e20b Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Thu, 29 Oct 2020 20:31:19 +0100
|
||||
Subject: [PATCH 02/33] 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>
|
||||
---
|
||||
src/dlmisc.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/dlmisc.c b/src/dlmisc.c
|
||||
index f20eb59373cf..1dd9135641c1 100644
|
||||
--- a/src/dlmisc.c
|
||||
+++ b/src/dlmisc.c
|
||||
@@ -46,7 +46,7 @@ static int snd_plugin_dir_set = 0;
|
||||
static char *snd_plugin_dir = NULL;
|
||||
#endif
|
||||
|
||||
-#if defined(DL_ORIGIN_AVAILABLE) && defined(HAVE_LIBPTHREAD)
|
||||
+#ifdef HAVE_LIBPTHREAD
|
||||
static pthread_mutex_t snd_dlpath_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
static inline void snd_dlpath_lock(void)
|
||||
@@ -440,12 +440,10 @@ void snd_dlobj_cache_cleanup(void)
|
||||
free(c);
|
||||
}
|
||||
snd_dlobj_unlock();
|
||||
-#ifdef DL_ORIGIN_AVAILABLE
|
||||
snd_dlpath_lock();
|
||||
snd_plugin_dir_set = 0;
|
||||
free(snd_plugin_dir);
|
||||
snd_plugin_dir = NULL;
|
||||
snd_dlpath_unlock();
|
||||
-#endif
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.26.2
|
||||
|
28
0003-pcm-snd_pcm_mmap_readi-fix-typo-in-comment.patch
Normal file
28
0003-pcm-snd_pcm_mmap_readi-fix-typo-in-comment.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 2757191e3b85d491705b31c6ecca2dbd96d26ade Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Thu, 29 Oct 2020 20:34:17 +0100
|
||||
Subject: [PATCH 03/33] pcm: snd_pcm_mmap_readi - fix typo in comment
|
||||
|
||||
\param size frames to be *read*
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_mmap.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c
|
||||
index 9600c3831238..9cbaae05250a 100644
|
||||
--- a/src/pcm/pcm_mmap.c
|
||||
+++ b/src/pcm/pcm_mmap.c
|
||||
@@ -183,7 +183,7 @@ snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_ufram
|
||||
* \brief Read interleaved frames from a PCM using direct buffer (mmap)
|
||||
* \param pcm PCM handle
|
||||
* \param buffer frames containing buffer
|
||||
- * \param size frames to be written
|
||||
+ * \param size frames to be read
|
||||
* \return a positive number of frames actually read otherwise a
|
||||
* negative error code
|
||||
* \retval -EBADFD PCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
|
||||
--
|
||||
2.26.2
|
||||
|
29
0007-pcm-set-the-snd_pcm_ioplug_status-tstamp-field.patch
Normal file
29
0007-pcm-set-the-snd_pcm_ioplug_status-tstamp-field.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 7d36895225d09ae26868997382445cc7ad2e9513 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Holmberg <jonashg@axis.com>
|
||||
Date: Wed, 4 Nov 2020 14:49:56 +0100
|
||||
Subject: [PATCH 07/33] 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>
|
||||
---
|
||||
src/pcm/pcm_ioplug.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
|
||||
index a437ca326778..9b1b8ac3b6fc 100644
|
||||
--- a/src/pcm/pcm_ioplug.c
|
||||
+++ b/src/pcm/pcm_ioplug.c
|
||||
@@ -115,6 +115,7 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
snd_pcm_ioplug_hw_ptr_update(pcm);
|
||||
status->state = io->data->state;
|
||||
status->trigger_tstamp = io->trigger_tstamp;
|
||||
+ gettimestamp(&status->tstamp, pcm->tstamp_type);
|
||||
status->avail = snd_pcm_mmap_avail(pcm);
|
||||
status->avail_max = io->avail_max;
|
||||
return 0;
|
||||
--
|
||||
2.26.2
|
||||
|
44
0009-pcm-Add-snd_pcm_audio_tstamp_type_t-constants.patch
Normal file
44
0009-pcm-Add-snd_pcm_audio_tstamp_type_t-constants.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From ea02dbd20a535085638c63c6b8bec94e628486c4 Mon Sep 17 00:00:00 2001
|
||||
From: David Henningsson <diwic@ubuntu.com>
|
||||
Date: Wed, 16 Dec 2020 19:55:22 +0100
|
||||
Subject: [PATCH 09/33] 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>
|
||||
---
|
||||
include/pcm.h | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/include/pcm.h b/include/pcm.h
|
||||
index 5b0782315585..cf1eea8bbc9b 100644
|
||||
--- a/include/pcm.h
|
||||
+++ b/include/pcm.h
|
||||
@@ -350,6 +350,20 @@ typedef enum _snd_pcm_tstamp_type {
|
||||
SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
|
||||
} snd_pcm_tstamp_type_t;
|
||||
|
||||
+typedef enum _snd_pcm_audio_tstamp_type {
|
||||
+ /**
|
||||
+ * first definition for backwards compatibility only,
|
||||
+ * maps to wallclock/link time for HDAudio playback and DEFAULT/DMA time for everything else
|
||||
+ */
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT = 0,
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT = 1, /**< DMA time, reported as per hw_ptr */
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK = 2, /**< link time reported by sample or wallclock counter, reset on startup */
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /**< link time reported by sample or wallclock counter, not reset on startup */
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /**< link time estimated indirectly */
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /**< link time synchronized with system time */
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
|
||||
+} snd_pcm_audio_tstamp_type_t;
|
||||
+
|
||||
typedef struct _snd_pcm_audio_tstamp_config {
|
||||
/* 5 of max 16 bits used */
|
||||
unsigned int type_requested:4;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,78 @@
|
||||
From dcda999d0000cbdabe61d3d175943b5f23c30057 Mon Sep 17 00:00:00 2001
|
||||
From: David Henningsson <diwic@ubuntu.com>
|
||||
Date: Wed, 16 Dec 2020 20:02:52 +0100
|
||||
Subject: [PATCH 10/33] 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>
|
||||
---
|
||||
test/audio_time.c | 26 +++++++++++++-------------
|
||||
1 file changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/test/audio_time.c b/test/audio_time.c
|
||||
index 530922d92d43..e4d4a9448c6d 100644
|
||||
--- a/test/audio_time.c
|
||||
+++ b/test/audio_time.c
|
||||
@@ -32,7 +32,7 @@ static void usage(char *command)
|
||||
"-d, --delay add delay \n"
|
||||
"-D, --device=NAME select PCM by name \n"
|
||||
"-p, --playback playback tstamps \n"
|
||||
- "-t, --ts_type=TYPE Default(0),link(1),link_estimated(2),synchronized(3) \n"
|
||||
+ "-t, --ts_type=TYPE Compat(0),default(1),link(2),link_absolute(3),link_estimated(4),link_synchronized(5) \n"
|
||||
"-r, --report show audio timestamp and accuracy validity\n"
|
||||
, command);
|
||||
}
|
||||
@@ -201,17 +201,17 @@ int main(int argc, char *argv[])
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 0))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT))
|
||||
printf("Playback supports audio compat timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 1))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT))
|
||||
printf("Playback supports audio default timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 2))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK))
|
||||
printf("Playback supports audio link timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 3))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE))
|
||||
printf("Playback supports audio link absolute timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 4))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED))
|
||||
printf("Playback supports audio link estimated timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, 5))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_p, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED))
|
||||
printf("Playback supports audio link synchronized timestamps\n");
|
||||
|
||||
snd_pcm_sw_params_alloca(&swparams_p);
|
||||
@@ -269,17 +269,17 @@ int main(int argc, char *argv[])
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 0))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_COMPAT))
|
||||
printf("Capture supports audio compat timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 1))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_DEFAULT))
|
||||
printf("Capture supports audio default timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 2))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK))
|
||||
printf("Capture supports audio link timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 3))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE))
|
||||
printf("Capture supports audio link absolute timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 4))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED))
|
||||
printf("Capture supports audio link estimated timestamps\n");
|
||||
- if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, 5))
|
||||
+ if (snd_pcm_hw_params_supports_audio_ts_type(hwparams_c, SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED))
|
||||
printf("Capture supports audio link synchronized timestamps\n");
|
||||
|
||||
snd_pcm_sw_params_alloca(&swparams_c);
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,30 @@
|
||||
From a9cbfecd87777d76a83e5a912ca9bdcf48e31fa9 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Tue, 22 Dec 2020 16:10:16 +0100
|
||||
Subject: [PATCH 11/33] pcm: Fix a typo in SND_PCM_AUDIO_TSTAMP_TYPE_LAST
|
||||
definition
|
||||
|
||||
It was wrongly defined with SNDRV_ prefix. Fix it.
|
||||
|
||||
Fixes: ea02dbd20a53 ("pcm: Add snd_pcm_audio_tstamp_type_t constants")
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
include/pcm.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/pcm.h b/include/pcm.h
|
||||
index cf1eea8bbc9b..e300b951c076 100644
|
||||
--- a/include/pcm.h
|
||||
+++ b/include/pcm.h
|
||||
@@ -361,7 +361,7 @@ typedef enum _snd_pcm_audio_tstamp_type {
|
||||
SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ABSOLUTE = 3, /**< link time reported by sample or wallclock counter, not reset on startup */
|
||||
SND_PCM_AUDIO_TSTAMP_TYPE_LINK_ESTIMATED = 4, /**< link time estimated indirectly */
|
||||
SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED = 5, /**< link time synchronized with system time */
|
||||
- SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
|
||||
+ SND_PCM_AUDIO_TSTAMP_TYPE_LAST = SND_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED
|
||||
} snd_pcm_audio_tstamp_type_t;
|
||||
|
||||
typedef struct _snd_pcm_audio_tstamp_config {
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 5275d170e05639473e68e5feb349aec65bf26428 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sat, 26 Dec 2020 14:35:39 -0700
|
||||
Subject: [PATCH 12/33] 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>
|
||||
---
|
||||
src/conf.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf.c b/src/conf.c
|
||||
index 7df2b4e77759..44d1bfde66ad 100644
|
||||
--- a/src/conf.c
|
||||
+++ b/src/conf.c
|
||||
@@ -1970,7 +1970,9 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in,
|
||||
SNDERR("%s:%d:%d:%s", fd->name ? fd->name : "_toplevel_", fd->line, fd->column, str);
|
||||
goto _end;
|
||||
}
|
||||
- if (get_char(&input) != LOCAL_UNEXPECTED_EOF) {
|
||||
+ err = get_char(&input);
|
||||
+ fd = input.current;
|
||||
+ if (err != LOCAL_UNEXPECTED_EOF) {
|
||||
SNDERR("%s:%d:%d:Unexpected }", fd->name ? fd->name : "", fd->line, fd->column);
|
||||
err = -EINVAL;
|
||||
goto _end;
|
||||
--
|
||||
2.26.2
|
||||
|
36
0013-ucm-fix-bad-frees-in-get_list0-and-get_list20.patch
Normal file
36
0013-ucm-fix-bad-frees-in-get_list0-and-get_list20.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From 0f4821ec1729cd72a3dde3ea63f7857e92a10919 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sat, 26 Dec 2020 14:35:40 -0700
|
||||
Subject: [PATCH 13/33] 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>
|
||||
---
|
||||
src/ucm/main.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/ucm/main.c b/src/ucm/main.c
|
||||
index 3871d5aab90b..754b967e9c07 100644
|
||||
--- a/src/ucm/main.c
|
||||
+++ b/src/ucm/main.c
|
||||
@@ -666,7 +666,7 @@ static int get_list0(struct list_head *list,
|
||||
}
|
||||
return cnt;
|
||||
__fail:
|
||||
- snd_use_case_free_list((const char **)res, cnt);
|
||||
+ snd_use_case_free_list(*result, cnt);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -724,7 +724,7 @@ static int get_list20(struct list_head *list,
|
||||
}
|
||||
return cnt;
|
||||
__fail:
|
||||
- snd_use_case_free_list((const char **)res, cnt);
|
||||
+ snd_use_case_free_list(*result, cnt);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,35 @@
|
||||
From c56278cfda55b9f5d106890c7354176dba8c8f4d Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sat, 26 Dec 2020 14:35:41 -0700
|
||||
Subject: [PATCH 14/33] 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>
|
||||
---
|
||||
src/rawmidi/rawmidi_virt.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rawmidi/rawmidi_virt.c b/src/rawmidi/rawmidi_virt.c
|
||||
index 2c4c27f5b2ca..884b8ff8deee 100644
|
||||
--- a/src/rawmidi/rawmidi_virt.c
|
||||
+++ b/src/rawmidi/rawmidi_virt.c
|
||||
@@ -315,7 +315,7 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
||||
int merge, int mode)
|
||||
{
|
||||
int err;
|
||||
- snd_rawmidi_t *rmidi;
|
||||
+ snd_rawmidi_t *rmidi = NULL;
|
||||
snd_rawmidi_virtual_t *virt = NULL;
|
||||
struct pollfd pfd;
|
||||
|
||||
@@ -392,6 +392,7 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
||||
free(*inputp);
|
||||
if (outputp)
|
||||
free(*outputp);
|
||||
+ free(rmidi);
|
||||
return err;
|
||||
}
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,28 @@
|
||||
From aa28847248f2f416d9ecc6cbfa75192455400f6f Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sat, 26 Dec 2020 14:35:43 -0700
|
||||
Subject: [PATCH 15/33] 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>
|
||||
---
|
||||
src/timer/timer_query_hw.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/timer/timer_query_hw.c b/src/timer/timer_query_hw.c
|
||||
index dad228c8ef01..d8bac6e7f0e4 100644
|
||||
--- a/src/timer/timer_query_hw.c
|
||||
+++ b/src/timer/timer_query_hw.c
|
||||
@@ -104,7 +104,7 @@ int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mo
|
||||
close(fd);
|
||||
return -SND_ERROR_INCOMPATIBLE_VERSION;
|
||||
}
|
||||
- tmr = (snd_timer_query_t *) calloc(1, sizeof(snd_timer_t));
|
||||
+ tmr = (snd_timer_query_t *) calloc(1, sizeof(snd_timer_query_t));
|
||||
if (tmr == NULL) {
|
||||
close(fd);
|
||||
return -ENOMEM;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 2e470d59d84a563a9efa81572ddc48d9858ceb92 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sat, 26 Dec 2020 14:35:44 -0700
|
||||
Subject: [PATCH 16/33] 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>
|
||||
---
|
||||
src/pcm/pcm_rate.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||
index 5bf7dbb94a61..dc38e95e1116 100644
|
||||
--- a/src/pcm/pcm_rate.c
|
||||
+++ b/src/pcm/pcm_rate.c
|
||||
@@ -746,7 +746,6 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
|
||||
if (result < 0)
|
||||
return result;
|
||||
__partial:
|
||||
- xfer = 0;
|
||||
cont = slave_frames;
|
||||
if (cont > slave_size)
|
||||
cont = slave_size;
|
||||
@@ -846,7 +845,6 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of
|
||||
if (result < 0)
|
||||
return result;
|
||||
__partial:
|
||||
- xfer = 0;
|
||||
cont = slave_frames;
|
||||
if (cont > rate->gen.slave->period_size)
|
||||
cont = rate->gen.slave->period_size;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,27 @@
|
||||
From fc719bfe4e97bbfce899cc7e67df08ecd573c5d3 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sat, 26 Dec 2020 14:35:45 -0700
|
||||
Subject: [PATCH 17/33] 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>
|
||||
---
|
||||
src/pcm/pcm_multi.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
|
||||
index 53c414d5f863..5fa09b9bf5d0 100644
|
||||
--- a/src/pcm/pcm_multi.c
|
||||
+++ b/src/pcm/pcm_multi.c
|
||||
@@ -1323,7 +1323,6 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
||||
err = -ENOMEM;
|
||||
goto _free;
|
||||
}
|
||||
- idx = 0;
|
||||
for (idx = 0; idx < channels_count; ++idx)
|
||||
channels_sidx[idx] = -1;
|
||||
idx = 0;
|
||||
--
|
||||
2.26.2
|
||||
|
27
0018-conf-fix-get_hexachar-return-value.patch
Normal file
27
0018-conf-fix-get_hexachar-return-value.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 9ebd29d2d31df0f8967f3e60cf24bb63c95d4984 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Sun, 27 Dec 2020 13:17:26 +0100
|
||||
Subject: [PATCH 18/33] conf: fix get_hexachar() return value
|
||||
|
||||
Reported-by: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/conf.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/conf.c b/src/conf.c
|
||||
index 44d1bfde66ad..6cfe65bfe8cd 100644
|
||||
--- a/src/conf.c
|
||||
+++ b/src/conf.c
|
||||
@@ -887,7 +887,7 @@ static inline int get_hexachar(input_t *input)
|
||||
if (c >= '0' && c <= '9') num |= (c - '0') << 0;
|
||||
else if (c >= 'a' && c <= 'f') num |= (c - 'a') << 0;
|
||||
else if (c >= 'A' && c <= 'F') num |= (c - 'A') << 0;
|
||||
- return c;
|
||||
+ return num;
|
||||
}
|
||||
|
||||
static int get_quotedchar(input_t *input)
|
||||
--
|
||||
2.26.2
|
||||
|
33
0019-pcm-fix-__snd_pcm_state-return-value.patch
Normal file
33
0019-pcm-fix-__snd_pcm_state-return-value.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 36aff79747b23b9535e81befe8b7b2972837bce3 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Sun, 27 Dec 2020 13:29:33 +0100
|
||||
Subject: [PATCH 19/33] 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>
|
||||
---
|
||||
src/pcm/pcm_local.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h
|
||||
index fe77e50def28..bec5a40855dc 100644
|
||||
--- a/src/pcm/pcm_local.h
|
||||
+++ b/src/pcm/pcm_local.h
|
||||
@@ -444,7 +444,7 @@ static inline int __snd_pcm_start(snd_pcm_t *pcm)
|
||||
static inline snd_pcm_state_t __snd_pcm_state(snd_pcm_t *pcm)
|
||||
{
|
||||
if (!pcm->fast_ops->state)
|
||||
- return -ENOSYS;
|
||||
+ return SND_PCM_STATE_OPEN;
|
||||
return pcm->fast_ops->state(pcm->fast_op_arg);
|
||||
}
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
36
0020-confmisc-fix-memory-leak-in-snd_func_concat.patch
Normal file
36
0020-confmisc-fix-memory-leak-in-snd_func_concat.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From a92ad2fea4b36d7282f4a571275fb492dd1bba75 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Date: Sun, 27 Dec 2020 18:43:15 -0700
|
||||
Subject: [PATCH 20/33] confmisc: fix memory leak in snd_func_concat
|
||||
|
||||
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
src/confmisc.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/confmisc.c b/src/confmisc.c
|
||||
index eb8218c1e150..3ce95c7a942c 100644
|
||||
--- a/src/confmisc.c
|
||||
+++ b/src/confmisc.c
|
||||
@@ -419,7 +419,6 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
||||
tmp = realloc(res, len + len1 + 1);
|
||||
if (tmp == NULL) {
|
||||
free(ptr);
|
||||
- free(res);
|
||||
err = -ENOMEM;
|
||||
goto __error;
|
||||
}
|
||||
@@ -440,8 +439,8 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
||||
err = snd_config_get_id(src, &id);
|
||||
if (err >= 0)
|
||||
err = snd_config_imake_string(dst, id, res);
|
||||
- free(res);
|
||||
__error:
|
||||
+ free(res);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 6c24cd2e60cc9c1fca809ffeeb7ffe8af94b201e Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Tue, 29 Dec 2020 11:15:46 +0100
|
||||
Subject: [PATCH 21/33] 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>
|
||||
---
|
||||
src/conf.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/conf.c b/src/conf.c
|
||||
index 6cfe65bfe8cd..3c943db2b576 100644
|
||||
--- a/src/conf.c
|
||||
+++ b/src/conf.c
|
||||
@@ -1977,6 +1977,7 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in,
|
||||
err = -EINVAL;
|
||||
goto _end;
|
||||
}
|
||||
+ err = 0;
|
||||
_end:
|
||||
while (fd->next) {
|
||||
fd_next = fd->next;
|
||||
--
|
||||
2.26.2
|
||||
|
46
0022-pcm-plugin-status-fix-the-return-value-regression.patch
Normal file
46
0022-pcm-plugin-status-fix-the-return-value-regression.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From afe6ff3b33ee6e5ea3511fe458bfd4e516b10bcf Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 30 Dec 2020 09:31:10 +0100
|
||||
Subject: [PATCH 22/33] 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: 4f90392f07e ("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>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index 5739cfc2eb07..76a524fa801d 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -541,19 +541,17 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
||||
static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
- snd_pcm_sframes_t err, avail;
|
||||
+ snd_pcm_sframes_t err;
|
||||
|
||||
/* sync with the latest hw and appl ptrs */
|
||||
- avail = snd_pcm_plugin_avail_update(pcm);
|
||||
- if (avail < 0)
|
||||
- return avail;
|
||||
+ snd_pcm_plugin_avail_update(pcm);
|
||||
|
||||
err = snd_pcm_status(plugin->gen.slave, status);
|
||||
if (err < 0)
|
||||
return err;
|
||||
status->appl_ptr = *pcm->appl.ptr;
|
||||
status->hw_ptr = *pcm->hw.ptr;
|
||||
- status->avail = avail;
|
||||
+ status->avail = snd_pcm_mmap_avail(pcm);
|
||||
status->delay = snd_pcm_mmap_delay(pcm);
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.26.2
|
||||
|
34
0023-pcm-plugin-status-revert-the-recent-changes.patch
Normal file
34
0023-pcm-plugin-status-revert-the-recent-changes.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 49eea5d7bc7d39f9a4cc1f3b3a813e90b90519eb Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Sun, 3 Jan 2021 16:16:10 +0100
|
||||
Subject: [PATCH 23/33] 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: afe6ff3b33e ("pcm: plugin status - fix the return value (regression)")
|
||||
Fixes: 4f90392f07e ("pcm: fix the snd_pcm_plugin_status() avail and delay fields")
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index 76a524fa801d..ea60eb98986e 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -551,8 +551,6 @@ static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
return err;
|
||||
status->appl_ptr = *pcm->appl.ptr;
|
||||
status->hw_ptr = *pcm->hw.ptr;
|
||||
- status->avail = snd_pcm_mmap_avail(pcm);
|
||||
- status->delay = snd_pcm_mmap_delay(pcm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
179
0024-pcm-plugin-tidy-snd_pcm_plugin_avail_update.patch
Normal file
179
0024-pcm-plugin-tidy-snd_pcm_plugin_avail_update.patch
Normal file
@ -0,0 +1,179 @@
|
||||
From fa1895aa2b4f3f154e537bee92860fe793045643 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Sun, 3 Jan 2021 16:34:04 +0100
|
||||
Subject: [PATCH 24/33] 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>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 142 +++++++++++++++++++++++--------------------
|
||||
1 file changed, 76 insertions(+), 66 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index ea60eb98986e..83793397a7f0 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -460,82 +460,92 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
|
||||
return xfer > 0 ? xfer : err;
|
||||
}
|
||||
|
||||
-static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
||||
+static snd_pcm_sframes_t
|
||||
+snd_pcm_plugin_sync_hw_ptr_capture(snd_pcm_t *pcm,
|
||||
+ snd_pcm_sframes_t slave_size)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_t *slave = plugin->gen.slave;
|
||||
- snd_pcm_sframes_t slave_size;
|
||||
+ const snd_pcm_channel_area_t *areas;
|
||||
+ snd_pcm_uframes_t xfer, hw_offset, size;
|
||||
int err;
|
||||
|
||||
- slave_size = snd_pcm_avail_update(slave);
|
||||
+ xfer = snd_pcm_mmap_capture_avail(pcm);
|
||||
+ size = pcm->buffer_size - xfer;
|
||||
+ areas = snd_pcm_mmap_areas(pcm);
|
||||
+ hw_offset = snd_pcm_mmap_hw_offset(pcm);
|
||||
+ while (size > 0 && slave_size > 0) {
|
||||
+ snd_pcm_uframes_t frames = size;
|
||||
+ snd_pcm_uframes_t cont = pcm->buffer_size - hw_offset;
|
||||
+ const snd_pcm_channel_area_t *slave_areas;
|
||||
+ snd_pcm_uframes_t slave_offset;
|
||||
+ snd_pcm_uframes_t slave_frames = ULONG_MAX;
|
||||
+ snd_pcm_sframes_t result;
|
||||
+ /* As mentioned in the ALSA API (see pcm/pcm.c:942):
|
||||
+ * The function #snd_pcm_avail_update()
|
||||
+ * have to be called before any mmap begin+commit operation.
|
||||
+ * Otherwise the snd_pcm_areas_copy will not called a second time.
|
||||
+ * But this is needed, if the ring buffer wrap is reached and
|
||||
+ * there is more data available.
|
||||
+ */
|
||||
+ slave_size = snd_pcm_avail_update(slave);
|
||||
+ result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
|
||||
+ if (result < 0) {
|
||||
+ err = result;
|
||||
+ goto error;
|
||||
+ }
|
||||
+ if (frames > cont)
|
||||
+ frames = cont;
|
||||
+ frames = (plugin->read)(pcm, areas, hw_offset, frames,
|
||||
+ slave_areas, slave_offset, &slave_frames);
|
||||
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
|
||||
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
|
||||
+ snd_pcm_sframes_t res;
|
||||
+ res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result);
|
||||
+ if (res < 0) {
|
||||
+ err = res;
|
||||
+ goto error;
|
||||
+ }
|
||||
+ frames -= res;
|
||||
+ }
|
||||
+ if (result <= 0) {
|
||||
+ err = result;
|
||||
+ goto error;
|
||||
+ }
|
||||
+ snd_pcm_mmap_hw_forward(pcm, frames);
|
||||
+ if (frames == cont)
|
||||
+ hw_offset = 0;
|
||||
+ else
|
||||
+ hw_offset += frames;
|
||||
+ size -= frames;
|
||||
+ slave_size -= slave_frames;
|
||||
+ xfer += frames;
|
||||
+ }
|
||||
+ return (snd_pcm_sframes_t)xfer;
|
||||
+error:
|
||||
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
|
||||
+}
|
||||
+
|
||||
+static snd_pcm_sframes_t snd_pcm_plugin_sync_hw_ptr(snd_pcm_t *pcm,
|
||||
+ snd_pcm_uframes_t slave_hw_ptr,
|
||||
+ snd_pcm_sframes_t slave_size)
|
||||
+{
|
||||
if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
|
||||
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
|
||||
pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED)
|
||||
- goto _capture;
|
||||
- *pcm->hw.ptr = *slave->hw.ptr;
|
||||
+ return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size);
|
||||
+ *pcm->hw.ptr = slave_hw_ptr;
|
||||
return slave_size;
|
||||
- _capture:
|
||||
- {
|
||||
- const snd_pcm_channel_area_t *areas;
|
||||
- snd_pcm_uframes_t xfer, hw_offset, size;
|
||||
-
|
||||
- xfer = snd_pcm_mmap_capture_avail(pcm);
|
||||
- size = pcm->buffer_size - xfer;
|
||||
- areas = snd_pcm_mmap_areas(pcm);
|
||||
- hw_offset = snd_pcm_mmap_hw_offset(pcm);
|
||||
- while (size > 0 && slave_size > 0) {
|
||||
- snd_pcm_uframes_t frames = size;
|
||||
- snd_pcm_uframes_t cont = pcm->buffer_size - hw_offset;
|
||||
- const snd_pcm_channel_area_t *slave_areas;
|
||||
- snd_pcm_uframes_t slave_offset;
|
||||
- snd_pcm_uframes_t slave_frames = ULONG_MAX;
|
||||
- snd_pcm_sframes_t result;
|
||||
- /* As mentioned in the ALSA API (see pcm/pcm.c:942):
|
||||
- * The function #snd_pcm_avail_update()
|
||||
- * have to be called before any mmap begin+commit operation.
|
||||
- * Otherwise the snd_pcm_areas_copy will not called a second time.
|
||||
- * But this is needed, if the ring buffer wrap is reached and
|
||||
- * there is more data available.
|
||||
- */
|
||||
- slave_size = snd_pcm_avail_update(slave);
|
||||
- result = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
|
||||
- if (result < 0) {
|
||||
- err = result;
|
||||
- goto error;
|
||||
- }
|
||||
- if (frames > cont)
|
||||
- frames = cont;
|
||||
- frames = (plugin->read)(pcm, areas, hw_offset, frames,
|
||||
- slave_areas, slave_offset, &slave_frames);
|
||||
- result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
|
||||
- if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
|
||||
- snd_pcm_sframes_t res;
|
||||
-
|
||||
- res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result);
|
||||
- if (res < 0) {
|
||||
- err = res;
|
||||
- goto error;
|
||||
- }
|
||||
- frames -= res;
|
||||
- }
|
||||
- if (result <= 0) {
|
||||
- err = result;
|
||||
- goto error;
|
||||
- }
|
||||
- snd_pcm_mmap_hw_forward(pcm, frames);
|
||||
- if (frames == cont)
|
||||
- hw_offset = 0;
|
||||
- else
|
||||
- hw_offset += frames;
|
||||
- size -= frames;
|
||||
- slave_size -= slave_frames;
|
||||
- xfer += frames;
|
||||
- }
|
||||
- return (snd_pcm_sframes_t)xfer;
|
||||
+}
|
||||
|
||||
- error:
|
||||
- return xfer > 0 ? (snd_pcm_sframes_t)xfer : err;
|
||||
- }
|
||||
+static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
||||
+{
|
||||
+ snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
+ snd_pcm_t *slave = plugin->gen.slave;
|
||||
+ snd_pcm_sframes_t slave_size;
|
||||
+
|
||||
+ slave_size = snd_pcm_avail_update(slave);
|
||||
+ return snd_pcm_plugin_sync_hw_ptr(pcm, *slave->hw.ptr, slave_size);
|
||||
}
|
||||
|
||||
static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
--
|
||||
2.26.2
|
||||
|
40
0025-pcm-plugin-optimize-sync-in-snd_pcm_plugin_status.patch
Normal file
40
0025-pcm-plugin-optimize-sync-in-snd_pcm_plugin_status.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 28cc099d9ea3962b033cb1cb9c3e07db828d9ff7 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Sun, 3 Jan 2021 16:41:29 +0100
|
||||
Subject: [PATCH 25/33] 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>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index 83793397a7f0..6a8151453efb 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -553,14 +553,11 @@ static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_sframes_t err;
|
||||
|
||||
- /* sync with the latest hw and appl ptrs */
|
||||
- snd_pcm_plugin_avail_update(pcm);
|
||||
-
|
||||
err = snd_pcm_status(plugin->gen.slave, status);
|
||||
if (err < 0)
|
||||
return err;
|
||||
- status->appl_ptr = *pcm->appl.ptr;
|
||||
- status->hw_ptr = *pcm->hw.ptr;
|
||||
+ assert(status->appl_ptr == *pcm->appl.ptr);
|
||||
+ snd_pcm_plugin_sync_hw_ptr(pcm, status->hw_ptr, status->avail);
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
35
0026-Revert-pcm_plugin-fix-delay.patch
Normal file
35
0026-Revert-pcm_plugin-fix-delay.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 21549e6583f1dfe5b2fe1aaa88345e4645dd96d0 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 30 Dec 2020 17:49:33 +0100
|
||||
Subject: [PATCH 26/33] Revert "pcm_plugin: fix delay"
|
||||
|
||||
This reverts commit aba87e509898ec9ddb3e319267d7c267409ff100.
|
||||
|
||||
The commit does not look good. The plugins must handle
|
||||
the delay value correctly.
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index 6a8151453efb..5787a43d09f4 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -142,12 +142,6 @@ static int snd_pcm_plugin_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
int err = snd_pcm_delay(plugin->gen.slave, &sd);
|
||||
if (err < 0)
|
||||
return err;
|
||||
- if (pcm->stream == SND_PCM_STREAM_CAPTURE &&
|
||||
- pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
|
||||
- pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
|
||||
- sd += snd_pcm_mmap_capture_avail(pcm);
|
||||
- }
|
||||
-
|
||||
*delayp = sd;
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,74 @@
|
||||
From 6ca01c07ee13435d6c2db4e9121d9a86cc4b1457 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Wed, 30 Dec 2020 19:14:25 +0100
|
||||
Subject: [PATCH 27/33] pcm: ioplug - fix the delay calculation in the status
|
||||
callback
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_ioplug.c | 32 ++++++++++++++++++--------------
|
||||
1 file changed, 18 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
|
||||
index 9b1b8ac3b6fc..f2315a10e87c 100644
|
||||
--- a/src/pcm/pcm_ioplug.c
|
||||
+++ b/src/pcm/pcm_ioplug.c
|
||||
@@ -107,9 +107,24 @@ static int snd_pcm_ioplug_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *i
|
||||
return snd_pcm_channel_info_shm(pcm, info, -1);
|
||||
}
|
||||
|
||||
+static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
+{
|
||||
+ ioplug_priv_t *io = pcm->private_data;
|
||||
+
|
||||
+ if (io->data->version >= 0x010001 &&
|
||||
+ io->data->callback->delay)
|
||||
+ return io->data->callback->delay(io->data, delayp);
|
||||
+ else {
|
||||
+ snd_pcm_ioplug_hw_ptr_update(pcm);
|
||||
+ *delayp = snd_pcm_mmap_hw_avail(pcm);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
ioplug_priv_t *io = pcm->private_data;
|
||||
+ snd_pcm_sframes_t sd;
|
||||
|
||||
memset(status, 0, sizeof(*status));
|
||||
snd_pcm_ioplug_hw_ptr_update(pcm);
|
||||
@@ -118,6 +133,9 @@ static int snd_pcm_ioplug_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
gettimestamp(&status->tstamp, pcm->tstamp_type);
|
||||
status->avail = snd_pcm_mmap_avail(pcm);
|
||||
status->avail_max = io->avail_max;
|
||||
+ if (snd_pcm_ioplug_delay(pcm, &sd) < 0)
|
||||
+ sd = snd_pcm_mmap_delay(pcm);
|
||||
+ status->delay = sd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -133,20 +151,6 @@ static int snd_pcm_ioplug_hwsync(snd_pcm_t *pcm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
-{
|
||||
- ioplug_priv_t *io = pcm->private_data;
|
||||
-
|
||||
- if (io->data->version >= 0x010001 &&
|
||||
- io->data->callback->delay)
|
||||
- return io->data->callback->delay(io->data, delayp);
|
||||
- else {
|
||||
- snd_pcm_ioplug_hw_ptr_update(pcm);
|
||||
- *delayp = snd_pcm_mmap_hw_avail(pcm);
|
||||
- }
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static int snd_pcm_ioplug_reset(snd_pcm_t *pcm)
|
||||
{
|
||||
ioplug_priv_t *io = pcm->private_data;
|
||||
--
|
||||
2.26.2
|
||||
|
85
0028-pcm-rate-tidy-up-snd_pcm_rate_avail_update.patch
Normal file
85
0028-pcm-rate-tidy-up-snd_pcm_rate_avail_update.patch
Normal file
@ -0,0 +1,85 @@
|
||||
From 5988bb3ff42827ab4c13f248291ad1767c8d973d Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Sun, 3 Jan 2021 16:56:38 +0100
|
||||
Subject: [PATCH 28/33] 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>
|
||||
---
|
||||
src/pcm/pcm_rate.c | 37 +++++++++++++++++++++----------------
|
||||
1 file changed, 21 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||
index dc38e95e1116..7073f8ab6c63 100644
|
||||
--- a/src/pcm/pcm_rate.c
|
||||
+++ b/src/pcm/pcm_rate.c
|
||||
@@ -964,29 +964,18 @@ static snd_pcm_sframes_t snd_pcm_rate_mmap_commit(snd_pcm_t *pcm,
|
||||
return size;
|
||||
}
|
||||
|
||||
-static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm)
|
||||
+static snd_pcm_sframes_t snd_pcm_rate_avail_update_capture(snd_pcm_t *pcm,
|
||||
+ snd_pcm_sframes_t slave_size)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
snd_pcm_t *slave = rate->gen.slave;
|
||||
- snd_pcm_sframes_t slave_size;
|
||||
-
|
||||
- slave_size = snd_pcm_avail_update(slave);
|
||||
- if (slave_size < 0)
|
||||
- return slave_size;
|
||||
-
|
||||
- if (pcm->stream == SND_PCM_STREAM_CAPTURE)
|
||||
- goto _capture;
|
||||
- snd_pcm_rate_sync_hwptr(pcm);
|
||||
- snd_pcm_rate_sync_playback_area(pcm, rate->appl_ptr);
|
||||
- return snd_pcm_mmap_avail(pcm);
|
||||
- _capture: {
|
||||
snd_pcm_uframes_t xfer, hw_offset, size;
|
||||
|
||||
xfer = snd_pcm_mmap_capture_avail(pcm);
|
||||
size = pcm->buffer_size - xfer;
|
||||
hw_offset = snd_pcm_mmap_hw_offset(pcm);
|
||||
while (size >= pcm->period_size &&
|
||||
- (snd_pcm_uframes_t)slave_size >= rate->gen.slave->period_size) {
|
||||
+ (snd_pcm_uframes_t)slave_size >= slave->period_size) {
|
||||
int err = snd_pcm_rate_grab_next_period(pcm, hw_offset);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@@ -994,13 +983,29 @@ static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm)
|
||||
return (snd_pcm_sframes_t)xfer;
|
||||
xfer += pcm->period_size;
|
||||
size -= pcm->period_size;
|
||||
- slave_size -= rate->gen.slave->period_size;
|
||||
+ slave_size -= slave->period_size;
|
||||
hw_offset += pcm->period_size;
|
||||
hw_offset %= pcm->buffer_size;
|
||||
snd_pcm_mmap_hw_forward(pcm, pcm->period_size);
|
||||
}
|
||||
return (snd_pcm_sframes_t)xfer;
|
||||
- }
|
||||
+}
|
||||
+
|
||||
+static snd_pcm_sframes_t snd_pcm_rate_avail_update(snd_pcm_t *pcm)
|
||||
+{
|
||||
+ snd_pcm_rate_t *rate = pcm->private_data;
|
||||
+ snd_pcm_sframes_t slave_size;
|
||||
+
|
||||
+ slave_size = snd_pcm_avail_update(rate->gen.slave);
|
||||
+ if (slave_size < 0)
|
||||
+ return slave_size;
|
||||
+
|
||||
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE)
|
||||
+ return snd_pcm_rate_avail_update_capture(pcm, slave_size);
|
||||
+
|
||||
+ snd_pcm_rate_sync_hwptr(pcm);
|
||||
+ snd_pcm_rate_sync_playback_area(pcm, rate->appl_ptr);
|
||||
+ return snd_pcm_mmap_avail(pcm);
|
||||
}
|
||||
|
||||
static int snd_pcm_rate_htimestamp(snd_pcm_t *pcm,
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,26 @@
|
||||
From 6cee452eabc5cfdf0a6955033b8ac8f6e12ea883 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Sun, 3 Jan 2021 17:13:50 +0100
|
||||
Subject: [PATCH 29/33] pcm: ioplug - fix the delay calculation for old plugins
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_ioplug.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
|
||||
index f2315a10e87c..e141b1f98da7 100644
|
||||
--- a/src/pcm/pcm_ioplug.c
|
||||
+++ b/src/pcm/pcm_ioplug.c
|
||||
@@ -116,7 +116,7 @@ static int snd_pcm_ioplug_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
return io->data->callback->delay(io->data, delayp);
|
||||
else {
|
||||
snd_pcm_ioplug_hw_ptr_update(pcm);
|
||||
- *delayp = snd_pcm_mmap_hw_avail(pcm);
|
||||
+ *delayp = snd_pcm_mmap_delay(pcm);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,31 @@
|
||||
From fc0f7af9ee7bd4c31c2bab229e8e79eb96e908fa Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Mon, 4 Jan 2021 12:29:00 +0100
|
||||
Subject: [PATCH 30/33] pcm: rate - use pcm_frame_diff() in
|
||||
snd_pcm_rate_playback_internal_delay()
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_rate.c | 6 +-----
|
||||
1 file changed, 1 insertion(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||
index 7073f8ab6c63..abb2753f6055 100644
|
||||
--- a/src/pcm/pcm_rate.c
|
||||
+++ b/src/pcm/pcm_rate.c
|
||||
@@ -612,11 +612,7 @@ static snd_pcm_uframes_t snd_pcm_rate_playback_internal_delay(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_rate_t *rate = pcm->private_data;
|
||||
|
||||
- if (rate->appl_ptr < rate->last_commit_ptr) {
|
||||
- return rate->appl_ptr - rate->last_commit_ptr + pcm->boundary;
|
||||
- } else {
|
||||
- return rate->appl_ptr - rate->last_commit_ptr;
|
||||
- }
|
||||
+ return pcm_frame_diff(rate->appl_ptr, rate->last_commit_ptr, pcm->boundary);
|
||||
}
|
||||
|
||||
static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
--
|
||||
2.26.2
|
||||
|
54
0031-pcm-plugin-fix-status-code-for-capture.patch
Normal file
54
0031-pcm-plugin-fix-status-code-for-capture.patch
Normal file
@ -0,0 +1,54 @@
|
||||
From da5b70d3fae091a8568b80a476c1cf340965805a Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Mon, 4 Jan 2021 12:32:25 +0100
|
||||
Subject: [PATCH 31/33] 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>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 21 +++++++++++++++++++--
|
||||
1 file changed, 19 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index 5787a43d09f4..7ed6f25a2eea 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -545,13 +545,30 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
||||
static int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
- snd_pcm_sframes_t err;
|
||||
+ snd_pcm_sframes_t err, diff;
|
||||
|
||||
err = snd_pcm_status(plugin->gen.slave, status);
|
||||
if (err < 0)
|
||||
return err;
|
||||
- assert(status->appl_ptr == *pcm->appl.ptr);
|
||||
snd_pcm_plugin_sync_hw_ptr(pcm, status->hw_ptr, status->avail);
|
||||
+ /*
|
||||
+ * For capture stream, the situation is more complicated, because
|
||||
+ * snd_pcm_plugin_avail_update() commits the data to the slave pcm.
|
||||
+ * It means that the slave appl_ptr is updated. Calculate diff and
|
||||
+ * update the delay and avail.
|
||||
+ *
|
||||
+ * This resolves the data inconsistency for immediate calls:
|
||||
+ * snd_pcm_avail_update()
|
||||
+ * snd_pcm_status()
|
||||
+ */
|
||||
+ if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
|
||||
+ status->appl_ptr = *pcm->appl.ptr;
|
||||
+ diff = pcm_frame_diff(status->appl_ptr, *pcm->appl.ptr, pcm->boundary);
|
||||
+ status->avail += diff;
|
||||
+ status->delay += diff;
|
||||
+ } else {
|
||||
+ assert(status->appl_ptr == *pcm->appl.ptr);
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
63
0032-pcm-rate-use-pcm_frame_diff-on-related-places.patch
Normal file
63
0032-pcm-rate-use-pcm_frame_diff-on-related-places.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From ac520b2ed11f31e789a4da1d55e360e3eaeac50d Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Mon, 4 Jan 2021 17:14:42 +0100
|
||||
Subject: [PATCH 32/33] pcm: rate - use pcm_frame_diff() on related places
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/pcm_rate.c | 20 +++++++-------------
|
||||
1 file changed, 7 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||
index abb2753f6055..3d301d0e317b 100644
|
||||
--- a/src/pcm/pcm_rate.c
|
||||
+++ b/src/pcm/pcm_rate.c
|
||||
@@ -561,17 +561,16 @@ snd_pcm_rate_read_areas1(snd_pcm_t *pcm,
|
||||
|
||||
static inline void snd_pcm_rate_sync_hwptr0(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_ptr)
|
||||
{
|
||||
- snd_pcm_rate_t *rate = pcm->private_data;
|
||||
-
|
||||
- snd_pcm_sframes_t slave_hw_ptr_diff = slave_hw_ptr - rate->last_slave_hw_ptr;
|
||||
+ snd_pcm_rate_t *rate;
|
||||
+ snd_pcm_sframes_t slave_hw_ptr_diff;
|
||||
snd_pcm_sframes_t last_slave_hw_ptr_frac;
|
||||
|
||||
if (pcm->stream != SND_PCM_STREAM_PLAYBACK)
|
||||
return;
|
||||
|
||||
- if (slave_hw_ptr_diff < 0)
|
||||
- slave_hw_ptr_diff += rate->gen.slave->boundary; /* slave boundary wraparound */
|
||||
- else if (slave_hw_ptr_diff == 0)
|
||||
+ rate = pcm->private_data;
|
||||
+ slave_hw_ptr_diff = pcm_frame_diff(slave_hw_ptr, rate->last_slave_hw_ptr, rate->gen.slave->boundary);
|
||||
+ if (slave_hw_ptr_diff == 0)
|
||||
return;
|
||||
last_slave_hw_ptr_frac = rate->last_slave_hw_ptr % rate->gen.slave->period_size;
|
||||
/* While handling fraction part fo slave period, rounded value will be
|
||||
@@ -922,10 +921,7 @@ static int snd_pcm_rate_sync_playback_area(snd_pcm_t *pcm, snd_pcm_uframes_t app
|
||||
if (slave_size < 0)
|
||||
return slave_size;
|
||||
|
||||
- if (appl_ptr < rate->last_commit_ptr)
|
||||
- xfer = appl_ptr - rate->last_commit_ptr + pcm->boundary;
|
||||
- else
|
||||
- xfer = appl_ptr - rate->last_commit_ptr;
|
||||
+ xfer = pcm_frame_diff(appl_ptr, rate->last_commit_ptr, pcm->boundary);
|
||||
while (xfer >= pcm->period_size &&
|
||||
(snd_pcm_uframes_t)slave_size >= rate->gen.slave->period_size) {
|
||||
err = snd_pcm_rate_commit_next_period(pcm, rate->last_commit_ptr % pcm->buffer_size);
|
||||
@@ -1059,9 +1055,7 @@ static int snd_pcm_rate_drain(snd_pcm_t *pcm)
|
||||
sw_params.avail_min = 1;
|
||||
snd_pcm_sw_params(rate->gen.slave, &sw_params);
|
||||
|
||||
- size = rate->appl_ptr - rate->last_commit_ptr;
|
||||
- if (size > pcm->boundary)
|
||||
- size -= pcm->boundary;
|
||||
+ size = pcm_frame_diff(rate->appl_ptr, rate->last_commit_ptr, pcm->boundary);
|
||||
ofs = rate->last_commit_ptr % pcm->buffer_size;
|
||||
while (size > 0) {
|
||||
snd_pcm_uframes_t psize, spsize;
|
||||
--
|
||||
2.26.2
|
||||
|
43
0033-pcm-rate-fix-the-capture-delay-values.patch
Normal file
43
0033-pcm-rate-fix-the-capture-delay-values.patch
Normal file
@ -0,0 +1,43 @@
|
||||
From b62f66442bfbcea7c11afe4917e196fa95a65083 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Mon, 4 Jan 2021 17:27:32 +0100
|
||||
Subject: [PATCH 33/33] 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>
|
||||
---
|
||||
src/pcm/pcm_rate.c | 8 ++------
|
||||
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||
index 3d301d0e317b..770aafea567d 100644
|
||||
--- a/src/pcm/pcm_rate.c
|
||||
+++ b/src/pcm/pcm_rate.c
|
||||
@@ -632,7 +632,7 @@ static int snd_pcm_rate_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
||||
+ snd_pcm_rate_playback_internal_delay(pcm);
|
||||
} else {
|
||||
*delayp = rate->ops.output_frames(rate->obj, slave_delay)
|
||||
- + snd_pcm_mmap_capture_hw_avail(pcm);
|
||||
+ + snd_pcm_mmap_capture_delay(pcm);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1157,12 +1157,8 @@ static int snd_pcm_rate_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||
status->avail = snd_pcm_mmap_playback_avail(pcm);
|
||||
status->avail_max = rate->ops.input_frames(rate->obj, status->avail_max);
|
||||
} else {
|
||||
- /* FIXME: Maybe possible to somthing similar to
|
||||
- * snd_pcm_rate_playback_internal_delay()
|
||||
- * for the capture case.
|
||||
- */
|
||||
status->delay = rate->ops.output_frames(rate->obj, status->delay)
|
||||
- + snd_pcm_mmap_capture_hw_avail(pcm);
|
||||
+ + snd_pcm_mmap_capture_delay(pcm);
|
||||
status->avail = snd_pcm_mmap_capture_avail(pcm);
|
||||
status->avail_max = rate->ops.output_frames(rate->obj, status->avail_max);
|
||||
}
|
||||
--
|
||||
2.26.2
|
||||
|
38
alsa.changes
38
alsa.changes
@ -1,3 +1,41 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 5 15:13:13 CET 2021 - tiwai@suse.de
|
||||
|
||||
- Backport upstream fixes:
|
||||
a PCM plugin regression fix about snd_pcm_status() call, plugin
|
||||
directory handling fixes, missing audio timestamp types,
|
||||
use-after-free fix for conf parser, PCM plugin delay account fixes,
|
||||
etc:
|
||||
0001-dlmisc-the-snd_plugin_dir_set-snd_plugin_dir-must-be.patch
|
||||
0002-dlmisc-fix-snd_plugin_dir-locking-for-not-DL_ORIGIN_.patch
|
||||
0003-pcm-snd_pcm_mmap_readi-fix-typo-in-comment.patch
|
||||
0007-pcm-set-the-snd_pcm_ioplug_status-tstamp-field.patch
|
||||
0009-pcm-Add-snd_pcm_audio_tstamp_type_t-constants.patch
|
||||
0010-test-audio_time-Make-use-of-SND_PCM_AUDIO_TSTAMP_TYP.patch
|
||||
0011-pcm-Fix-a-typo-in-SND_PCM_AUDIO_TSTAMP_TYPE_LAST-def.patch
|
||||
0012-conf-fix-use-after-free-in-_snd_config_load_with_inc.patch
|
||||
0013-ucm-fix-bad-frees-in-get_list0-and-get_list20.patch
|
||||
0014-rawmidi-fix-memory-leak-in-snd_rawmidi_virtual_open.patch
|
||||
0015-timer-fix-sizeof-operator-mismatch-in-snd_timer_quer.patch
|
||||
0016-pcm-remove-dead-assignments-from-snd_pcm_rate_-commi.patch
|
||||
0017-pcm_multi-remove-dead-assignment-from-_snd_pcm_multi.patch
|
||||
0018-conf-fix-get_hexachar-return-value.patch
|
||||
0019-pcm-fix-__snd_pcm_state-return-value.patch
|
||||
0020-confmisc-fix-memory-leak-in-snd_func_concat.patch
|
||||
0021-conf-fix-return-code-in-_snd_config_load_with_includ.patch
|
||||
0022-pcm-plugin-status-fix-the-return-value-regression.patch
|
||||
0023-pcm-plugin-status-revert-the-recent-changes.patch
|
||||
0024-pcm-plugin-tidy-snd_pcm_plugin_avail_update.patch
|
||||
0025-pcm-plugin-optimize-sync-in-snd_pcm_plugin_status.patch
|
||||
0026-Revert-pcm_plugin-fix-delay.patch
|
||||
0027-pcm-ioplug-fix-the-delay-calculation-in-the-status-c.patch
|
||||
0028-pcm-rate-tidy-up-snd_pcm_rate_avail_update.patch
|
||||
0029-pcm-ioplug-fix-the-delay-calculation-for-old-plugins.patch
|
||||
0030-pcm-rate-use-pcm_frame_diff-in-snd_pcm_rate_playback.patch
|
||||
0031-pcm-plugin-fix-status-code-for-capture.patch
|
||||
0032-pcm-rate-use-pcm_frame_diff-on-related-places.patch
|
||||
0033-pcm-rate-fix-the-capture-delay-values.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 21 12:42:25 CEST 2020 - tiwai@suse.de
|
||||
|
||||
|
60
alsa.spec
60
alsa.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package alsa
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -52,6 +52,35 @@ Source30: all_notes_off
|
||||
Source31: all_notes_off.bin
|
||||
Source32: all_notes_off.mid
|
||||
Source34: alsa-init.sh
|
||||
Patch1: 0001-dlmisc-the-snd_plugin_dir_set-snd_plugin_dir-must-be.patch
|
||||
Patch2: 0002-dlmisc-fix-snd_plugin_dir-locking-for-not-DL_ORIGIN_.patch
|
||||
Patch3: 0003-pcm-snd_pcm_mmap_readi-fix-typo-in-comment.patch
|
||||
Patch7: 0007-pcm-set-the-snd_pcm_ioplug_status-tstamp-field.patch
|
||||
Patch9: 0009-pcm-Add-snd_pcm_audio_tstamp_type_t-constants.patch
|
||||
Patch10: 0010-test-audio_time-Make-use-of-SND_PCM_AUDIO_TSTAMP_TYP.patch
|
||||
Patch11: 0011-pcm-Fix-a-typo-in-SND_PCM_AUDIO_TSTAMP_TYPE_LAST-def.patch
|
||||
Patch12: 0012-conf-fix-use-after-free-in-_snd_config_load_with_inc.patch
|
||||
Patch13: 0013-ucm-fix-bad-frees-in-get_list0-and-get_list20.patch
|
||||
Patch14: 0014-rawmidi-fix-memory-leak-in-snd_rawmidi_virtual_open.patch
|
||||
Patch15: 0015-timer-fix-sizeof-operator-mismatch-in-snd_timer_quer.patch
|
||||
Patch16: 0016-pcm-remove-dead-assignments-from-snd_pcm_rate_-commi.patch
|
||||
Patch17: 0017-pcm_multi-remove-dead-assignment-from-_snd_pcm_multi.patch
|
||||
Patch18: 0018-conf-fix-get_hexachar-return-value.patch
|
||||
Patch19: 0019-pcm-fix-__snd_pcm_state-return-value.patch
|
||||
Patch20: 0020-confmisc-fix-memory-leak-in-snd_func_concat.patch
|
||||
Patch21: 0021-conf-fix-return-code-in-_snd_config_load_with_includ.patch
|
||||
Patch22: 0022-pcm-plugin-status-fix-the-return-value-regression.patch
|
||||
Patch23: 0023-pcm-plugin-status-revert-the-recent-changes.patch
|
||||
Patch24: 0024-pcm-plugin-tidy-snd_pcm_plugin_avail_update.patch
|
||||
Patch25: 0025-pcm-plugin-optimize-sync-in-snd_pcm_plugin_status.patch
|
||||
Patch26: 0026-Revert-pcm_plugin-fix-delay.patch
|
||||
Patch27: 0027-pcm-ioplug-fix-the-delay-calculation-in-the-status-c.patch
|
||||
Patch28: 0028-pcm-rate-tidy-up-snd_pcm_rate_avail_update.patch
|
||||
Patch29: 0029-pcm-ioplug-fix-the-delay-calculation-for-old-plugins.patch
|
||||
Patch30: 0030-pcm-rate-use-pcm_frame_diff-in-snd_pcm_rate_playback.patch
|
||||
Patch31: 0031-pcm-plugin-fix-status-code-for-capture.patch
|
||||
Patch32: 0032-pcm-rate-use-pcm_frame_diff-on-related-places.patch
|
||||
Patch33: 0033-pcm-rate-fix-the-capture-delay-values.patch
|
||||
# rest suse fixes
|
||||
Patch101: alsa-lib-ignore-non-accessible-ALSA_CONFIG_PATH.patch
|
||||
BuildRequires: doxygen
|
||||
@ -140,6 +169,35 @@ This package contains the library for ALSA topology support.
|
||||
|
||||
%prep
|
||||
%setup -q -n alsa-lib-%{version}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch7 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch101 -p1
|
||||
|
||||
%build
|
||||
|
Loading…
Reference in New Issue
Block a user