From ea7781d7d07870871a3703c1b32fe177b8ba7a18 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 14 Apr 2023 17:52:26 +0200 Subject: [PATCH] alsa: fix area pointers We should use the first and step fields to get to the first byte in the area. See #3069 --- spa/plugins/alsa/alsa-pcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 53407f4b0..fd941ceb3 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -2179,7 +2179,7 @@ again: if (SPA_LIKELY(state->use_mmap)) { for (i = 0; i < b->buf->n_datas; i++) { - spa_memcpy(SPA_PTROFF(my_areas[i].addr, off * frame_size, void), + spa_memcpy(snd_pcm_channel_area_addr(&my_areas[i], off), SPA_PTROFF(d[i].data, offs, void), n_bytes); } } else { @@ -2290,11 +2290,11 @@ push_frames(struct state *state, for (i = 0; i < b->buf->n_datas; i++) { spa_memcpy(d[i].data, - SPA_PTROFF(my_areas[i].addr, offset * frame_size, void), + snd_pcm_channel_area_addr(&my_areas[i], offset), l0); if (SPA_UNLIKELY(l1 > 0)) spa_memcpy(SPA_PTROFF(d[i].data, l0, void), - my_areas[i].addr, + snd_pcm_channel_area_addr(&my_areas[i], 0), l1); d[i].chunk->offset = 0; d[i].chunk->size = n_bytes; -- 2.40.0