[pulseaudio-discuss] [PATCH] mix: Fix mixing of S24 samples stored as S32RE

Peter Meerwald pmeerw at pmeerw.net
Mon Aug 4 05:42:00 PDT 2014


pa_mix_s24_32re_c() should advance m->ptr by sizeof(int32_t)

http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-July/020998.html

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulsecore/mix.c  | 2 +-
 src/tests/mix-test.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pulsecore/mix.c b/src/pulsecore/mix.c
index 4b789a6..10567d6 100644
--- a/src/pulsecore/mix.c
+++ b/src/pulsecore/mix.c
@@ -445,7 +445,7 @@ static void pa_mix_s24_32re_c(pa_mix_info streams[], unsigned nstreams, unsigned
                 v = (v * cv) >> 16;
                 sum += v;
             }
-            m->ptr = (uint8_t*) m->ptr + 3;
+            m->ptr = (uint8_t*) m->ptr + sizeof(int32_t);
         }
 
         sum = PA_CLAMP_UNLIKELY(sum, -0x80000000LL, 0x7FFFFFFFLL);
diff --git a/src/tests/mix-test.c b/src/tests/mix-test.c
index ae65209..9e5a0cc 100644
--- a/src/tests/mix-test.c
+++ b/src/tests/mix-test.c
@@ -126,7 +126,7 @@ static const uint32_t s24_32le_result[3][10] = {
 static const uint32_t s24_32be_result[3][10] = {
 { 0x00000001, 0xffff0002, 0x7fff0003, 0x80000004, 0x9fff0005, 0x3fff0006, 0x00010007, 0xf0000008, 0x00200009, 0x0021000a },
 { 0x00000000, 0x65e60000, 0xf1e50000, 0x73000000, 0x0ee60000, 0xb8e50000, 0xe6000000, 0xd7000000, 0xcc1c0000, 0xb31d0000 },
-{ 0x00000000, 0xe5010200, 0x00036400, 0x0470e500, 0xf3000000, 0xe5010500, 0x0006ad00, 0x07f7e400, 0xe6010000, 0x00000800 },
+{ 0x00000000, 0x64e60100, 0x70e50100, 0xf3000000, 0xade50100, 0xf7e40100, 0xe6010000, 0xc7010000, 0xcc3c0000, 0xb33e0000 },
 };
 
 static void compare_block(const pa_sample_spec *ss, const pa_memchunk *chunk, int iter) {
-- 
1.9.1



More information about the pulseaudio-discuss mailing list