From 08f3bab53db0875a0d9314ec6756051504f6876d Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 26 Apr 2023 09:42:29 +0300 Subject: [PATCH] audio: mixin_mixout_generic: normal_mix: Update src/dst after each copy The copying part of the functions need to update the src/dst buffer pointers after each iteration to correctly account for the possible wrap of the buffer. This was discovered while doing pause - 1sec_wait - resume - 3sec_wait cycles and around the 10th iteration audio became 'metallic' sounding. Signed-off-by: Peter Ujfalusi --- src/audio/mixin_mixout/mixin_mixout_generic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/audio/mixin_mixout/mixin_mixout_generic.c b/src/audio/mixin_mixout/mixin_mixout_generic.c index b1a82de30eef..01b7ce11aec1 100644 --- a/src/audio/mixin_mixout/mixin_mixout_generic.c +++ b/src/audio/mixin_mixout/mixin_mixout_generic.c @@ -56,6 +56,8 @@ static void normal_mix_channel_s16(struct audio_stream __sparse_cache *sink, int nmax = audio_stream_samples_without_wrap_s16(sink, dst); n = MIN(n, nmax); memcpy_s(dst, n * sizeof(int16_t), src, n * sizeof(int16_t)); + dst += n; + src += n; } } @@ -196,6 +198,8 @@ static void normal_mix_channel_s24(struct audio_stream __sparse_cache *sink, int nmax = audio_stream_samples_without_wrap_s24(sink, dst); n = MIN(n, nmax); memcpy_s(dst, n * sizeof(int32_t), src, n * sizeof(int32_t)); + dst += n; + src += n; } } @@ -306,6 +310,8 @@ static void normal_mix_channel_s32(struct audio_stream __sparse_cache *sink, int nmax = audio_stream_samples_without_wrap_s32(sink, dst); n = MIN(n, nmax); memcpy_s(dst, n * sizeof(int32_t), src, n * sizeof(int32_t)); + dst += n; + src += n; } }