[pulseaudio] 01/02: Pick patches from upstream fixing tests

Felipe Sateler fsateler at moszumanska.debian.org
Thu Aug 14 14:02:25 UTC 2014


This is an automated email from the git hooks/post-receive script.

fsateler pushed a commit to branch enable-tests
in repository pulseaudio.

commit 644a7a9eea6f0603a0e6ad2b4eddad8989326e45
Author: Felipe Sateler <fsateler at debian.org>
Date:   Wed Aug 13 23:44:01 2014 -0400

    Pick patches from upstream fixing tests
---
 ...ndianmacros-Fix-PA_MAYBE_INT16_SWAP-macro.patch |  27 ++
 ...fix-pa_get_binary_name-on-debian-kfreebsd.patch |  18 -
 ...ix-mixing-of-S24-samples-stored-as-S32RE.patch} |  18 +-
 debian/patches/series                              |   7 +-
 debian/patches/tests-Cleanup-mix-test.patch        |  41 +++
 .../tests-Fix-mix-test-on-big-endian-systems.patch | 364 +++++++++++++++++++++
 ...Fix-pa_get_binary_name-on-Debian-kFreeBSD.patch |  38 +++
 7 files changed, 490 insertions(+), 23 deletions(-)

diff --git a/debian/patches/endianmacros-Fix-PA_MAYBE_INT16_SWAP-macro.patch b/debian/patches/endianmacros-Fix-PA_MAYBE_INT16_SWAP-macro.patch
new file mode 100644
index 0000000..d98f81a
--- /dev/null
+++ b/debian/patches/endianmacros-Fix-PA_MAYBE_INT16_SWAP-macro.patch
@@ -0,0 +1,27 @@
+From a39a3b3f7df3ece773bb74b8c6baa599272704e0 Mon Sep 17 00:00:00 2001
+From: Peter Meerwald <pmeerw at pmeerw.net>
+Date: Wed, 6 Aug 2014 11:47:34 +0200
+Subject: [PATCH 4/6] endianmacros: Fix PA_MAYBE_INT16_SWAP() macro
+
+PA_MAYBE_INT16_SWAP() should call PA_INT16_SWAP(), not PA_INT32_SWAP
+
+PA_MAYBE_INT16_SWAP() is not used (yet), so no big deal :)
+
+Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
+---
+ src/pulsecore/endianmacros.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/pulsecore/endianmacros.h
++++ b/src/pulsecore/endianmacros.h
+@@ -82,8 +82,8 @@ static inline float PA_FLOAT32_SWAP(floa
+     return t.f;
+ }
+ 
+-#define PA_MAYBE_INT16_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : (x))
+-#define PA_MAYBE_UINT16_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : (x))
++#define PA_MAYBE_INT16_SWAP(c,x) ((c) ? PA_INT16_SWAP(x) : (x))
++#define PA_MAYBE_UINT16_SWAP(c,x) ((c) ? PA_UINT16_SWAP(x) : (x))
+ 
+ #define PA_MAYBE_INT32_SWAP(c,x) ((c) ? PA_INT32_SWAP(x) : (x))
+ #define PA_MAYBE_UINT32_SWAP(c,x) ((c) ? PA_UINT32_SWAP(x) : (x))
diff --git a/debian/patches/fix-pa_get_binary_name-on-debian-kfreebsd.patch b/debian/patches/fix-pa_get_binary_name-on-debian-kfreebsd.patch
deleted file mode 100644
index 2213c2e..0000000
--- a/debian/patches/fix-pa_get_binary_name-on-debian-kfreebsd.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Author: Peter Meerwald pmeerw at pmeerw.net
-Description: util: Fix pa_get_binary_name() on	Debian/kFreeBSD
- Debian GNU/kFreeBSD uses a FreeBSD kernel and GLIBC,
- it #defines __FreeBSD_kernel__, but not __FreeBSD__ nor __linux__
- Debian GNU/kFreeBSD does have a /proc/self/exe
- .
- FreeBSD #defines __FreeBSD__ and __FreeBSD_kernel__
---- a/src/pulse/util.c
-+++ b/src/pulse/util.c
-@@ -181,7 +181,7 @@ char *pa_get_binary_name(char *s, size_t
-     }
- #endif
- 
--#ifdef __linux__
-+#ifdef __linux__ || defined(__FreeBSD_kernel__)
-     {
-         char *rp;
-         /* This works on Linux only */
diff --git a/debian/patches/fix-mixing-of-s24-samples-stored-as-s32re.patch b/debian/patches/mix-Fix-mixing-of-S24-samples-stored-as-S32RE.patch
similarity index 68%
rename from debian/patches/fix-mixing-of-s24-samples-stored-as-s32re.patch
rename to debian/patches/mix-Fix-mixing-of-S24-samples-stored-as-S32RE.patch
index 31799ca..1bd8bf7 100644
--- a/debian/patches/fix-mixing-of-s24-samples-stored-as-s32re.patch
+++ b/debian/patches/mix-Fix-mixing-of-S24-samples-stored-as-S32RE.patch
@@ -1,6 +1,18 @@
-Author: Peter Meerwald <pmeerw at pmeerw.net>
-Description: mix: Fix mixing of S24 samples stored as S32RE
- pa_mix_s24_32re_c() should advance m->ptr by sizeof(int32_t)
+From 1499271f46c5b7289a61a4fa508cc412544842c4 Mon Sep 17 00:00:00 2001
+From: Peter Meerwald <pmeerw at pmeerw.net>
+Date: Mon, 4 Aug 2014 14:42:00 +0200
+Subject: [PATCH 1/6] mix: Fix mixing of S24 samples stored as S32RE
+
+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(-)
+
 --- a/src/pulsecore/mix.c
 +++ b/src/pulsecore/mix.c
 @@ -445,7 +445,7 @@ static void pa_mix_s24_32re_c(pa_mix_inf
diff --git a/debian/patches/series b/debian/patches/series
index 04c8b33..cd646a8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,5 +7,8 @@ only-autostart-kde-version.patch
 rtp-recv-fix-crash-on-empty-UDP-packets-CVE-2014-397.patch
 zsh-completion-Fix-completion-for-default-sink-sourc.patch
 gnu-kfreebsd.patch
-fix-pa_get_binary_name-on-debian-kfreebsd.patch
-fix-mixing-of-s24-samples-stored-as-s32re.patch
+mix-Fix-mixing-of-S24-samples-stored-as-S32RE.patch
+tests-Cleanup-mix-test.patch
+endianmacros-Fix-PA_MAYBE_INT16_SWAP-macro.patch
+tests-Fix-mix-test-on-big-endian-systems.patch
+util-Fix-pa_get_binary_name-on-Debian-kFreeBSD.patch
diff --git a/debian/patches/tests-Cleanup-mix-test.patch b/debian/patches/tests-Cleanup-mix-test.patch
new file mode 100644
index 0000000..e628723
--- /dev/null
+++ b/debian/patches/tests-Cleanup-mix-test.patch
@@ -0,0 +1,41 @@
+From e14863334b7e9267b3b3bbab08edf4a019411e89 Mon Sep 17 00:00:00 2001
+From: Peter Meerwald <pmeerw at pmeerw.net>
+Date: Wed, 6 Aug 2014 11:47:33 +0200
+Subject: [PATCH 3/6] tests: Cleanup mix-test
+
+indentation and use of fabsf() for floats
+
+Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
+---
+ src/tests/mix-test.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/src/tests/mix-test.c
++++ b/src/tests/mix-test.c
+@@ -202,7 +202,7 @@ static void compare_block(const pa_sampl
+ 
+             for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+                 float uu = ss->format == PA_SAMPLE_FLOAT32NE ? *u : PA_FLOAT32_SWAP(*u);
+-                fail_unless(fabs(uu - *v) <= 1e-6, NULL);
++                fail_unless(fabsf(uu - *v) <= 1e-6f, NULL);
+                 ++u;
+                 ++v;
+             }
+@@ -215,7 +215,7 @@ static void compare_block(const pa_sampl
+ 
+             for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+                 float uu = ss->format == PA_SAMPLE_FLOAT32NE ? *u : PA_FLOAT32_SWAP(*u);
+-                fail_unless(fabs(uu - *v) <= 1e-6, NULL);
++                fail_unless(fabsf(uu - *v) <= 1e-6f, NULL);
+                 ++u;
+                 ++v;
+             }
+@@ -385,7 +385,7 @@ static pa_memblock* generate_block(pa_me
+                 for (i = 0; i < 10; i++)
+                     u[i] = PA_FLOAT32_SWAP(float_samples[i]);
+             } else
+-              memcpy(d, float_samples, sizeof(float_samples));
++                memcpy(d, float_samples, sizeof(float_samples));
+ 
+             break;
+         }
diff --git a/debian/patches/tests-Fix-mix-test-on-big-endian-systems.patch b/debian/patches/tests-Fix-mix-test-on-big-endian-systems.patch
new file mode 100644
index 0000000..0aed324
--- /dev/null
+++ b/debian/patches/tests-Fix-mix-test-on-big-endian-systems.patch
@@ -0,0 +1,364 @@
+From eca6217129e835e1beabd13e7ca839ef0f89ddd0 Mon Sep 17 00:00:00 2001
+From: Peter Meerwald <pmeerw at pmeerw.net>
+Date: Wed, 6 Aug 2014 11:19:57 +0200
+Subject: [PATCH 5/6] tests: Fix mix-test on big-endian systems
+
+the mix test code never worked on big-endian systems
+
+patch saves a lot of duplicate test and uses more logical naming
+
+see
+http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-August/021035.html
+
+Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
+Reported-by: Felipe Sateler <fsateler at debian.org>
+---
+ src/tests/mix-test.c | 229 ++++++++++++---------------------------------------
+ 1 file changed, 54 insertions(+), 175 deletions(-)
+
+--- a/src/tests/mix-test.c
++++ b/src/tests/mix-test.c
+@@ -56,79 +56,37 @@ static const uint8_t ulaw_result[3][10]
+ { 0x00, 0xff, 0xff, 0x80, 0x91, 0x31, 0x00, 0xe9, 0x12, 0x13 },
+ };
+ 
+-/* PA_SAMPLE_S16LE */
+-static const uint16_t s16le_result[3][10] = {
++static const uint16_t s16ne_result[3][10] = {
+ { 0x0000, 0xffff, 0x7fff, 0x8000, 0x9fff, 0x3fff, 0x0001, 0xf000, 0x0020, 0x0021 },
+ { 0x0000, 0xffff, 0x7332, 0x8ccd, 0xa998, 0x3998, 0x0000, 0xf199, 0x001c, 0x001d },
+ { 0x0000, 0xfffe, 0x7fff, 0x8000, 0x8000, 0x7997, 0x0001, 0xe199, 0x003c, 0x003e },
+ };
+ 
+-/* PA_SAMPLE_S16BE */
+-static const uint16_t s16be_result[3][10] = {
+-{ 0x0000, 0xffff, 0x7fff, 0x8000, 0x9fff, 0x3fff, 0x0001, 0xf000, 0x0020, 0x0021 },
+-{ 0x0000, 0xffff, 0x8bff, 0x7300, 0xa8ff, 0x52ff, 0xe600, 0xd700, 0xcc1c, 0xb31d },
+-{ 0x0000, 0xfeff, 0x0aff, 0xf300, 0x47ff, 0x91fe, 0xe601, 0xc701, 0xcc3c, 0xb33e },
+-};
+-
+-/* PA_SAMPLE_FLOAT32LE */
+-static const float float32le_result[3][10] = {
+-{ 0.000000, -1.000000, 1.000000, 4711.000000, 0.222000, 0.330000, -0.300000, 99.000000, -0.555000, -0.123000 },
+-{ 0.000000, -0.899987, 0.899987, 4239.837402, 0.199797, 0.296996, -0.269996, 89.098679, -0.499493, -0.110698 },
+-{ 0.000000, -1.899987, 1.899987, 8950.837891, 0.421797, 0.626996, -0.569996, 188.098679, -1.054493, -0.233698 },
+-};
+-
+-/* PA_SAMPLE_FLOAT32BE */
+-static const float float32be_result[3][10] = {
++static const float float32ne_result[3][10] = {
+ { 0.000000, -1.000000, 1.000000, 4711.000000, 0.222000, 0.330000, -0.300000, 99.000000, -0.555000, -0.123000 },
+ { 0.000000, -0.899987, 0.899987, 4239.837402, 0.199797, 0.296996, -0.269996, 89.098679, -0.499493, -0.110698 },
+ { 0.000000, -1.899987, 1.899987, 8950.837891, 0.421797, 0.626996, -0.569996, 188.098679, -1.054493, -0.233698 },
+ };
+ 
+-/* PA_SAMPLE_S32LE */
+-static const uint32_t s32le_result[3][10] = {
++static const uint32_t s32ne_result[3][10] = {
+ { 0x00000001, 0xffff0002, 0x7fff0003, 0x80000004, 0x9fff0005, 0x3fff0006, 0x00010007, 0xf0000008, 0x00200009, 0x0021000a },
+ { 0x00000000, 0xffff199b, 0x7332199c, 0x8ccd0003, 0xa998d99e, 0x3998999f, 0x0000e66c, 0xf199a007, 0x001cccc8, 0x001db32e },
+ { 0x00000001, 0xfffe199d, 0x7fffffff, 0x80000000, 0x80000000, 0x799799a5, 0x0001e673, 0xe199a00f, 0x003cccd1, 0x003eb338 },
+ };
+ 
+-/* PA_SAMPLE_S32BE */
+-static const uint32_t s32be_result[3][10] = {
+-{ 0x00000001, 0xffff0002, 0x7fff0003, 0x80000004, 0x9fff0005, 0x3fff0006, 0x00010007, 0xf0000008, 0x00200009, 0x0021000a },
+-{ 0x0066e600, 0x65b2cd01, 0xf117b402, 0x73989903, 0x0ee48004, 0xb8496705, 0xe6ca4c06, 0xd7303307, 0xccb21908, 0xb3190009 },
+-{ 0x0066e601, 0x64b2ce03, 0x7017b505, 0xf3989907, 0xade38109, 0xf748680b, 0xe6cb4c0d, 0xc731330f, 0xccd21911, 0xb33a0013 },
+-};
+-
+-/* PA_SAMPLE_S24LE */
+-static const uint8_t s24le_result[3][30] = {
+-{ 0x00, 0x00, 0x01, 0xff, 0xff, 0x02, 0x7f, 0xff, 0x03, 0x80, 0x00, 0x04, 0x9f, 0xff, 0x05, 0x3f, 0xff, 0x06, 0x01, 0x00, 0x07, 0xf0, 0x00, 0x08, 0x20, 0x00, 0x09, 0x21, 0x00, 0x0a },
+-{ 0x66, 0xe6, 0x00, 0x31, 0xb3, 0x02, 0x23, 0x99, 0x03, 0x0b, 0x9a, 0x03, 0x0c, 0x66, 0x05, 0x1c, 0x4c, 0x06, 0xca, 0x4c, 0x06, 0x07, 0x34, 0x07, 0xb2, 0x19, 0x08, 0x19, 0x00, 0x09 },
+-{ 0x66, 0xe6, 0x01, 0x30, 0xb3, 0x05, 0xa2, 0x98, 0x07, 0x8b, 0x9a, 0x07, 0xab, 0x65, 0x0b, 0x5b, 0x4b, 0x0d, 0xcb, 0x4c, 0x0d, 0xf7, 0x34, 0x0f, 0xd2, 0x19, 0x11, 0x3a, 0x00, 0x13 },
+-};
+-
+-/* PA_SAMPLE_S24BE */
++/* attention: result is in BE, not NE! */
+ static const uint8_t s24be_result[3][30] = {
+-{ 0x00, 0x00, 0x01, 0xff, 0xff, 0x02, 0x7f, 0xff, 0x03, 0x80, 0x00, 0x04, 0x9f, 0xff, 0x05, 0x3f, 0xff, 0x06, 0x01, 0x00, 0x07,
+-    0xf0, 0x00, 0x08, 0x20, 0x00, 0x09, 0x21, 0x00, 0x0a },
+-{ 0x00, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x73, 0x32, 0x1c, 0x8c, 0xcd, 0x03, 0xa9, 0x98, 0xde, 0x39, 0x98, 0x9f, 0x00, 0xe6, 0x6c,
+-    0xf1, 0x99, 0xa7, 0x1c, 0xcc, 0xc8, 0x1d, 0xb3, 0x2e },
+-{ 0x00, 0x00, 0x01, 0xff, 0xfe, 0x1d, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x79, 0x97, 0xa5, 0x01, 0xe6, 0x73,
+-    0xe1, 0x99, 0xaf, 0x3c, 0xcc, 0xd1, 0x3e, 0xb3, 0x38 },
++{ 0x00, 0x00, 0x01, 0xff, 0xff, 0x02, 0x7f, 0xff, 0x03, 0x80, 0x00, 0x04, 0x9f, 0xff, 0x05, 0x3f, 0xff, 0x06, 0x01, 0x00, 0x07, 0xf0, 0x00, 0x08, 0x20, 0x00, 0x09, 0x21, 0x00, 0x0a },
++{ 0x00, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x73, 0x32, 0x1c, 0x8c, 0xcd, 0x03, 0xa9, 0x98, 0xde, 0x39, 0x98, 0x9f, 0x00, 0xe6, 0x6c, 0xf1, 0x99, 0xa7, 0x1c, 0xcc, 0xc8, 0x1d, 0xb3, 0x2e },
++{ 0x00, 0x00, 0x01, 0xff, 0xfe, 0x1d, 0x7f, 0xff, 0xff, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x79, 0x97, 0xa5, 0x01, 0xe6, 0x73, 0xe1, 0x99, 0xaf, 0x3c, 0xcc, 0xd1, 0x3e, 0xb3, 0x38 },
+ };
+ 
+-/* PA_SAMPLE_S24_32LE */
+-static const uint32_t s24_32le_result[3][10] = {
++static const uint32_t s24_32ne_result[3][10] = {
+ { 0x00000001, 0xffff0002, 0x7fff0003, 0x80000004, 0x9fff0005, 0x3fff0006, 0x00010007, 0xf0000008, 0x00200009, 0x0021000a },
+ { 0x00000000, 0x00ff199b, 0x00ff199c, 0x00000003, 0x00ff199e, 0x00ff199f, 0x0000e66c, 0x00000007, 0x001cccc8, 0x001db32e },
+ { 0x00000001, 0x00fe199d, 0x00fe199f, 0x00000007, 0x00fe19a3, 0x00fe19a5, 0x0001e673, 0x0000000f, 0x003cccd1, 0x003eb338 },
+ };
+ 
+-/* PA_SAMPLE_S24_32BE */
+-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, 0x64e60100, 0x70e50100, 0xf3000000, 0xade50100, 0xf7e40100, 0xe6010000, 0xc7010000, 0xcc3c0000, 0xb33e0000 },
+-};
+-
+ static void compare_block(const pa_sample_spec *ss, const pa_memchunk *chunk, int iter) {
+     void *d;
+     unsigned i;
+@@ -172,49 +130,27 @@ static void compare_block(const pa_sampl
+             break;
+         }
+ 
+-        case PA_SAMPLE_S16LE: {
+-            const uint16_t *v = s16le_result[iter];
+-            uint16_t *u = d;
+-
+-            for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
+-                ++u;
+-                ++v;
+-            }
+-            break;
+-        }
+-
+-        case PA_SAMPLE_S16BE: {
+-            const uint16_t *v = s16be_result[iter];
++        case PA_SAMPLE_S16NE:
++        case PA_SAMPLE_S16RE: {
++            const uint16_t *v = s16ne_result[iter];
+             uint16_t *u = d;
+ 
+             for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
+-                ++u;
+-                ++v;
+-            }
+-            break;
+-        }
+-
+-        case PA_SAMPLE_FLOAT32LE: {
+-            const float *v = float32le_result[iter];
+-            float *u = d;
+-
+-            for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                float uu = ss->format == PA_SAMPLE_FLOAT32NE ? *u : PA_FLOAT32_SWAP(*u);
+-                fail_unless(fabsf(uu - *v) <= 1e-6f, NULL);
++                uint16_t uu = PA_MAYBE_UINT16_SWAP(ss->format != PA_SAMPLE_S16NE, *u);
++                fail_unless(uu == *v, NULL);
+                 ++u;
+                 ++v;
+             }
+             break;
+         }
+ 
+-        case PA_SAMPLE_FLOAT32BE: {
+-            const float *v = float32be_result[iter];
++        case PA_SAMPLE_FLOAT32NE:
++        case PA_SAMPLE_FLOAT32RE: {
++            const float *v = float32ne_result[iter];
+             float *u = d;
+ 
+             for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                float uu = ss->format == PA_SAMPLE_FLOAT32NE ? *u : PA_FLOAT32_SWAP(*u);
++                float uu = PA_MAYBE_FLOAT32_SWAP(ss->format != PA_SAMPLE_FLOAT32NE, *u);
+                 fail_unless(fabsf(uu - *v) <= 1e-6f, NULL);
+                 ++u;
+                 ++v;
+@@ -222,77 +158,42 @@ static void compare_block(const pa_sampl
+             break;
+         }
+ 
+-        case PA_SAMPLE_S32LE: {
+-            const uint32_t *v = s32le_result[iter];
+-            uint32_t *u = d;
+-
+-            for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
+-                ++u;
+-                ++v;
+-            }
+-            break;
+-        }
+-
+-        case PA_SAMPLE_S32BE: {
+-            const uint32_t *v = s32be_result[iter];
+-            uint32_t *u = d;
+-
+-            for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
+-                ++u;
+-                ++v;
+-            }
+-            break;
+-        }
+-
+-        case PA_SAMPLE_S24_32LE: {
+-            const uint32_t *v = s24_32le_result[iter];
++        case PA_SAMPLE_S32NE:
++        case PA_SAMPLE_S32RE: {
++            const uint32_t *v = s32ne_result[iter];
+             uint32_t *u = d;
+ 
+             for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
++                uint32_t uu = PA_MAYBE_UINT32_SWAP(ss->format != PA_SAMPLE_S32NE, *u);
++                fail_unless(uu == *v, NULL);
+                 ++u;
+                 ++v;
+             }
+             break;
+         }
+ 
+-        case PA_SAMPLE_S24_32BE: {
+-            const uint32_t *v = s24_32be_result[iter];
++        case PA_SAMPLE_S24_32NE:
++        case PA_SAMPLE_S24_32RE: {
++            const uint32_t *v = s24_32ne_result[iter];
+             uint32_t *u = d;
+ 
+             for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
++                uint32_t uu = PA_MAYBE_UINT32_SWAP(ss->format != PA_SAMPLE_S24_32NE, *u);
++                fail_unless(uu == *v, NULL);
+                 ++u;
+                 ++v;
+             }
+             break;
+         }
+ 
+-        case PA_SAMPLE_S24LE: {
+-            const uint8_t *v = s24le_result[iter];
+-            uint8_t *u = d;
+-
+-            for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
+-                fail_unless(*(u+1) == *(v+1), NULL);
+-                fail_unless(*(u+2) == *(v+2), NULL);
+-
+-                u += 3;
+-                v += 3;
+-            }
+-            break;
+-        }
+-
+-        case PA_SAMPLE_S24BE: {
++        case PA_SAMPLE_S24NE:
++        case PA_SAMPLE_S24RE: {
+             const uint8_t *v = s24be_result[iter];
+             uint8_t *u = d;
+ 
+             for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+-                fail_unless(*u == *v, NULL);
+-                fail_unless(*(u+1) == *(v+1), NULL);
+-                fail_unless(*(u+2) == *(v+2), NULL);
++                uint32_t uu = ss->format == PA_SAMPLE_S24LE ? PA_READ24LE(u) : PA_READ24BE(u);
++                fail_unless(uu == PA_READ24BE(v), NULL);
+ 
+                 u += 3;
+                 v += 3;
+@@ -320,23 +221,18 @@ static pa_memblock* generate_block(pa_me
+         case PA_SAMPLE_U8:
+         case PA_SAMPLE_ULAW:
+         case PA_SAMPLE_ALAW: {
+-            static const uint8_t u8_samples[] = {
+-                0x00, 0xFF, 0x7F, 0x80, 0x9f,
+-                0x3f, 0x01, 0xF0, 0x20, 0x21
+-            };
+-
+-            memcpy(d, u8_samples, sizeof(u8_samples));
++            memcpy(d, u8_result[0], sizeof(u8_result[0]));
+             break;
+         }
+ 
+         case PA_SAMPLE_S16NE:
+         case PA_SAMPLE_S16RE: {
+-            static const uint16_t u16_samples[] = {
+-                0x0000, 0xFFFF, 0x7FFF, 0x8000, 0x9fff,
+-                0x3fff, 0x0001, 0xF000, 0x0020, 0x0021
+-            };
+-
+-            memcpy(d, u16_samples, sizeof(u16_samples));
++            if (ss->format == PA_SAMPLE_S16RE) {
++                uint16_t *u = d;
++                for (i = 0; i < 10; i++)
++                    u[i] = PA_UINT16_SWAP(s16ne_result[0][i]);
++            } else
++                memcpy(d, s16ne_result[0], sizeof(s16ne_result[0]));
+             break;
+         }
+ 
+@@ -344,48 +240,33 @@ static pa_memblock* generate_block(pa_me
+         case PA_SAMPLE_S24_32RE:
+         case PA_SAMPLE_S32NE:
+         case PA_SAMPLE_S32RE: {
+-            static const uint32_t u32_samples[] = {
+-                0x00000001, 0xFFFF0002, 0x7FFF0003, 0x80000004, 0x9fff0005,
+-                0x3fff0006, 0x00010007, 0xF0000008, 0x00200009, 0x0021000A
+-            };
+-
+-            memcpy(d, u32_samples, sizeof(u32_samples));
++            if (ss->format == PA_SAMPLE_S24_32RE || ss->format == PA_SAMPLE_S32RE) {
++                uint32_t *u = d;
++                for (i = 0; i < 10; i++)
++                    u[i] = PA_UINT32_SWAP(s32ne_result[0][i]);
++            } else
++                memcpy(d, s32ne_result[0], sizeof(s32ne_result[0]));
+             break;
+         }
+ 
+         case PA_SAMPLE_S24NE:
+-        case PA_SAMPLE_S24RE: {
+-            /* Need to be on a byte array because they are not aligned */
+-            static const uint8_t u24_samples[] = {
+-                0x00, 0x00, 0x01,
+-                0xFF, 0xFF, 0x02,
+-                0x7F, 0xFF, 0x03,
+-                0x80, 0x00, 0x04,
+-                0x9f, 0xff, 0x05,
+-                0x3f, 0xff, 0x06,
+-                0x01, 0x00, 0x07,
+-                0xF0, 0x00, 0x08,
+-                0x20, 0x00, 0x09,
+-                0x21, 0x00, 0x0A
+-            };
+-
+-            memcpy(d, u24_samples, sizeof(u24_samples));
++        case PA_SAMPLE_S24RE:
++            if (ss->format == PA_SAMPLE_S24LE) {
++                uint8_t *u = d;
++                for (i = 0; i < 30; i += 3)
++                    PA_WRITE24LE(&u[i], PA_READ24BE(&s24be_result[0][i]));
++            } else
++                memcpy(d, s24be_result[0], sizeof(s24be_result[0]));
+             break;
+-        }
+ 
+         case PA_SAMPLE_FLOAT32NE:
+         case PA_SAMPLE_FLOAT32RE: {
+-            float *u = d;
+-            static const float float_samples[] = {
+-                0.0f, -1.0f, 1.0f, 4711.0f, 0.222f,
+-                0.33f, -.3f, 99.0f, -0.555f, -.123f
+-            };
+-
+             if (ss->format == PA_SAMPLE_FLOAT32RE) {
++                float *u = d;
+                 for (i = 0; i < 10; i++)
+-                    u[i] = PA_FLOAT32_SWAP(float_samples[i]);
++                    u[i] = PA_FLOAT32_SWAP(float32ne_result[0][i]);
+             } else
+-                memcpy(d, float_samples, sizeof(float_samples));
++                memcpy(d, float32ne_result[0], sizeof(float32ne_result[0]));
+ 
+             break;
+         }
+@@ -427,8 +308,6 @@ START_TEST (mix_test) {
+         i.length = pa_memblock_get_length(i.memblock);
+         i.index = 0;
+ 
+-        compare_block(&a, &i, 0);
+-
+         /* Make a copy */
+         j = i;
+         pa_memblock_ref(j.memblock);
diff --git a/debian/patches/util-Fix-pa_get_binary_name-on-Debian-kFreeBSD.patch b/debian/patches/util-Fix-pa_get_binary_name-on-Debian-kFreeBSD.patch
new file mode 100644
index 0000000..7152d4e
--- /dev/null
+++ b/debian/patches/util-Fix-pa_get_binary_name-on-Debian-kFreeBSD.patch
@@ -0,0 +1,38 @@
+From 8a4a4f408c3e71a67b2134c21b971ce54a571fd1 Mon Sep 17 00:00:00 2001
+From: Peter Meerwald <pmeerw at pmeerw.net>
+Date: Mon, 4 Aug 2014 14:45:23 +0200
+Subject: [PATCH 6/6] util: Fix pa_get_binary_name() on Debian/kFreeBSD
+
+Debian GNU/kFreeBSD uses a FreeBSD kernel and GLIBC,
+it #defines __FreeBSD_kernel__, but not __FreeBSD__ nor __linux__
+Debian GNU/kFreeBSD does have a /proc/self/exe
+
+FreeBSD #defines __FreeBSD__ and __FreeBSD_kernel__
+
+problem reporte here:
+http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-July/020998.html
+
+http://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe and
+http://stackoverflow.com/questions/933850/how-to-find-the-location-of-the-executable-in-c have some
+background info
+
+Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
+---
+ src/pulse/util.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/pulse/util.c
++++ b/src/pulse/util.c
+@@ -181,10 +181,10 @@ char *pa_get_binary_name(char *s, size_t
+     }
+ #endif
+ 
+-#ifdef __linux__
++#if defined(__linux__) || defined(__FreeBSD_kernel__)
+     {
+         char *rp;
+-        /* This works on Linux only */
++        /* This works on Linux and Debian/kFreeBSD */
+ 
+         if ((rp = pa_readlink("/proc/self/exe"))) {
+             pa_strlcpy(s, pa_path_get_filename(rp), l);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-pulseaudio/pulseaudio.git



More information about the pkg-pulseaudio-devel mailing list