- Backport upstream fixes: yet more PCM plugin fixes, topology fixes/cleanups, UAF fix in UCM (bsc#1181194): 0004-topology-use-inclusive-language-for-bclk.patch 0005-topology-use-inclusive-language-for-fsync.patch 0006-topology-use-inclusive-language-in-documentation.patch 0034-ucm-fix-possible-memory-leak-in-parse_verb_file.patch 0035-topology-tplg_pprint_integer-fix-coverity-uninitaliz.patch 0036-topology-tplg_add_widget_object-do-not-use-invalid-e.patch 0037-topology-tplg_decode_pcm-add-missing-log-argument-co.patch 0038-topology-parse_tuple_set-remove-dead-condition-code.patch 0039-ucm-uc_mgr_substitute_tree-fix-use-after-free.patch 0040-topology-sort_config-cleanups-use-goto-for-the-error.patch 0041-conf-USB-add-Xonar-U7-MKII-to-USB-Audio.pcm.iec958_d.patch 0042-pcm_plugin-set-the-initial-hw_ptr-appl_ptr-from-the-.patch 0043-pcm-dmix-dshare-delay-calculation-fixes-and-cleanups.patch 0044-topology-fix-parse_tuple_set-remove-dead-condition-c.patch OBS-URL: https://build.opensuse.org/request/show/865334 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=292
65 lines
2.3 KiB
Diff
65 lines
2.3 KiB
Diff
From 0de72e63d7bd180566c71f6fb01d7719525ee326 Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Tue, 19 Jan 2021 11:17:00 +0100
|
|
Subject: [PATCH 43/44] pcm: dmix/dshare - delay calculation fixes and cleanups
|
|
|
|
Unfortunately, we cannot use status->avail from slave, because this value
|
|
does not wrap to the buffer size and it may even overflow slave boundary
|
|
(endless run). We can use only hw_ptr from slave.
|
|
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
src/pcm/pcm_dmix.c | 5 ++---
|
|
src/pcm/pcm_dshare.c | 5 ++---
|
|
2 files changed, 4 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
|
|
index 5b7472d90c58..be2675aff0f3 100644
|
|
--- a/src/pcm/pcm_dmix.c
|
|
+++ b/src/pcm/pcm_dmix.c
|
|
@@ -488,8 +488,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|
case SNDRV_PCM_STATE_DRAINING:
|
|
case SNDRV_PCM_STATE_RUNNING:
|
|
snd_pcm_dmix_sync_ptr0(pcm, status->hw_ptr);
|
|
- status->delay += snd_pcm_mmap_playback_delay(pcm)
|
|
- + status->avail - dmix->spcm->buffer_size;
|
|
+ status->delay = snd_pcm_mmap_playback_delay(pcm);
|
|
break;
|
|
default:
|
|
break;
|
|
@@ -518,7 +517,7 @@ static int snd_pcm_dmix_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|
case SNDRV_PCM_STATE_PREPARED:
|
|
case SNDRV_PCM_STATE_SUSPENDED:
|
|
case STATE_RUN_PENDING:
|
|
- *delayp = snd_pcm_mmap_playback_hw_avail(pcm);
|
|
+ *delayp = snd_pcm_mmap_playback_delay(pcm);
|
|
return 0;
|
|
case SNDRV_PCM_STATE_XRUN:
|
|
return -EPIPE;
|
|
diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
|
|
index 8a6725729bc7..10243013714d 100644
|
|
--- a/src/pcm/pcm_dshare.c
|
|
+++ b/src/pcm/pcm_dshare.c
|
|
@@ -237,8 +237,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|
case SNDRV_PCM_STATE_DRAINING:
|
|
case SNDRV_PCM_STATE_RUNNING:
|
|
snd_pcm_dshare_sync_ptr0(pcm, status->hw_ptr);
|
|
- status->delay += snd_pcm_mmap_playback_delay(pcm)
|
|
- + status->avail - dshare->spcm->buffer_size;
|
|
+ status->delay += snd_pcm_mmap_playback_delay(pcm);
|
|
break;
|
|
default:
|
|
break;
|
|
@@ -290,7 +289,7 @@ static int snd_pcm_dshare_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|
case SNDRV_PCM_STATE_PREPARED:
|
|
case SNDRV_PCM_STATE_SUSPENDED:
|
|
case STATE_RUN_PENDING:
|
|
- *delayp = snd_pcm_mmap_playback_hw_avail(pcm);
|
|
+ *delayp = snd_pcm_mmap_playback_delay(pcm);
|
|
return 0;
|
|
case SNDRV_PCM_STATE_XRUN:
|
|
return -EPIPE;
|
|
--
|
|
2.26.2
|
|
|