alsa/0012-pcm-dmix-fix-access-to-sum-buffer-in-non-interleaved.patch
Takashi Iwai 4f7fd72c0e Accepting request 836375 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes:
  0001-ucm-substitution-remove-duplicate-allow_empty-assign.patch
  0002-ucm-fix-parse_get_safe_name-safe-name-must-be-checke.patch
  0003-ucm-substitute-the-merged-tree-completely.patch
  0004-ctl-improve-documentation-for-identifier-of-control-.patch
  0005-pcm-dmix-make-lockless-operation-optional.patch
  0006-pcm-dmix-Fix-semaphore-usage-with-lockless-operation.patch
  0007-pcm-iec958-implement-HDMI-HBR-audio-formatting.patch
  0008-pcm-iec958-set-channel-status-bits-according-to-rate.patch
  0009-conf-pcm-USB-Added-S-PDIF-fix-for-Asus-Xonar-SE.patch
  0010-control-ctlparse-fix-enum-values-in-or.patch
  0011-conf-USB-Audio-Disable-IEC958-on-Lenovo-ThinkStation.patch
  0012-pcm-dmix-fix-access-to-sum-buffer-in-non-interleaved.patch
  0014-control-Add-documentation-for-snd_ctl_elem_list_.patch
  0015-conf-quote-also-strings-with-and-characters-in-strin.patch
  0016-topology-decode-Fix-channel-map-memory-allocation.patch
  0017-topology-decode-Fix-infinite-loop-in-decoding-enum-c.patch
  0018-topology-decode-Remove-decoding-values-for-enum-cont.patch
  0019-topology-decode-Add-enum-control-texts-as-separate-e.patch
  0020-topology-decode-Fix-printing-texts-section.patch
  0021-topology-decode-Change-declaration-of-enum-decoding-.patch
  0022-topology-decode-Fix-decoding-PCM-formats-and-rates.patch
  0023-topology-decode-Print-sig_bits-field-in-PCM-capabili.patch
  0024-topology-decode-Add-DAI-name-printing.patch
  0025-topology-Make-buffer-for-saving-dynamic-size.patch
  0026-topology-return-correct-value-in-tplg_save_printf.patch
  0027-topology-fix-some-gcc10-warnings-labs-signess.patch
  0028-topology-fix-sort_config.patch
  0029-topology-fix-the-unaligned-access.patch
  0030-topology-improve-the-printf-buffer-management.patch

OBS-URL: https://build.opensuse.org/request/show/836375
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=281
2020-09-23 16:47:30 +00:00

93 lines
2.7 KiB
Diff

From 82cb27c165d4337fe3183668bd0fa21ff6287e8e Mon Sep 17 00:00:00 2001
From: Vijay Palaniswamy <vijay.palaniswamy@in.bosch.com>
Date: Thu, 23 Jul 2020 11:49:10 +0530
Subject: [PATCH 12/32] pcm: dmix: fix access to sum-buffer in non-interleaved
mixing mode
When dmix uses non-interleaved mixing mode the offset and step width
to sum_buffer was calculated by using the dmix channels instead of
the slave channels. This leads to audio distortions due to frame
corruption.
example:
- With below configuratio, Do aplay on both device in parallel for
audio distortion
pcm.dmix_2_channels {
type dmix
ipc_key 5678293
ipc_perm 0660
ipc_gid audio
bindings [0 1]
slave {
pcm "hardware"
channels 2
periods 4
period_time 40000
}
}
pcm.dmix_1_channels {
type dmix
ipc_key 5678293
ipc_perm 0660
ipc_gid audio
bindings [0]
slave {
pcm "hardware"
channels 1
periods 4
period_time 40000
}
}
pcm.hardware {
type hw
card 0
channels 2
rate 48000
format S16_LE
}
Signed-off-by: Vijay Palaniswamy <vijay.palaniswamy@in.bosch.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_dmix.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
index e9343b19a536..8bce7aca85f7 100644
--- a/src/pcm/pcm_dmix.c
+++ b/src/pcm/pcm_dmix.c
@@ -212,10 +212,10 @@ static void mix_areas(snd_pcm_direct_t *dmix,
do_mix_areas(size,
((unsigned char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + dst_ofs * dst_step,
((unsigned char *)src_areas[chn].addr + src_areas[chn].first / 8) + src_ofs * src_step,
- dmix->u.dmix.sum_buffer + channels * dst_ofs + chn,
+ dmix->u.dmix.sum_buffer + dmix->shmptr->s.channels * dst_ofs + dchn,
dst_step,
src_step,
- channels * sizeof(signed int));
+ dmix->shmptr->s.channels * sizeof(signed int));
}
}
@@ -280,10 +280,10 @@ static void remix_areas(snd_pcm_direct_t *dmix,
do_remix_areas(size,
((unsigned char *)dst_areas[dchn].addr + dst_areas[dchn].first / 8) + dst_ofs * dst_step,
((unsigned char *)src_areas[chn].addr + src_areas[chn].first / 8) + src_ofs * src_step,
- dmix->u.dmix.sum_buffer + channels * dst_ofs + chn,
+ dmix->u.dmix.sum_buffer + dmix->shmptr->s.channels * dst_ofs + dchn,
dst_step,
src_step,
- channels * sizeof(signed int));
+ dmix->shmptr->s.channels * sizeof(signed int));
}
}
--
2.16.4