[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.15-80-ge0f0821
Lennart Poettering
gitmailer-noreply at 0pointer.de
Thu Apr 30 19:22:16 PDT 2009
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 5a2898db8a532481c024c41bf0b94e39b34ac29e (commit)
- Log -----------------------------------------------------------------
e0f0821 sconv: fix a few minor conversion issues
5caf09d resampler-test: add tests for 24bit sample formats
76caa27 resampler-test: use global PA_FLOAT32_SWAP implementation
4bffc78 alsa: initialize buffer size before number of periods to improve compat with some backends
d2b5ae5 sample-util: fix iteration loop when adjusting volume of s24 samples
3a7b287 sample-util: properly allocate silence block for s24-32 formats
076830a endian: fix LE/BE order for 24 bit accessor functions
947bf5d zeroconf: properly unref native protocol object
d4b10d8 sample: correctly pass s24-32 formats
4129f51 alsa: don't hit an assert when invalid module arguments are passed
-----------------------------------------------------------------------
Summary of changes:
src/modules/alsa/alsa-sink.c | 3 +-
src/modules/alsa/alsa-source.c | 3 +-
src/modules/alsa/alsa-util.c | 33 +++++++++------
src/modules/module-zeroconf-publish.c | 3 +
src/pulse/sample.c | 8 ++--
src/pulsecore/endianmacros.h | 8 ++--
src/pulsecore/sample-util.c | 12 ++++--
src/pulsecore/sconv-s16le.c | 10 ++--
src/pulsecore/sconv.c | 2 +-
src/tests/resampler-test.c | 75 ++++++++++++++++++++++++++++-----
10 files changed, 113 insertions(+), 44 deletions(-)
-----------------------------------------------------------------------
commit 4129f5119407da54708d1504c0ffa2d0888fa804
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:11:30 2009 +0200
alsa: don't hit an assert when invalid module arguments are passed
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 41e8b47..4d8dade 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -1770,7 +1770,8 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
fail:
- userdata_free(u);
+ if (u)
+ userdata_free(u);
return NULL;
}
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index 843f70b..d49035c 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1621,7 +1621,8 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
fail:
- userdata_free(u);
+ if (u)
+ userdata_free(u);
return NULL;
}
commit d4b10d838a79a46f18876dbb4a3206b5e1c7bc09
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:12:24 2009 +0200
sample: correctly pass s24-32 formats
diff --git a/src/pulse/sample.c b/src/pulse/sample.c
index 1e67b03..ed7b1b0 100644
--- a/src/pulse/sample.c
+++ b/src/pulse/sample.c
@@ -231,13 +231,13 @@ pa_sample_format_t pa_parse_sample_format(const char *format) {
else if (strcasecmp(format, "s24re") == 0)
return PA_SAMPLE_S24RE;
else if (strcasecmp(format, "s24-32le") == 0)
- return PA_SAMPLE_S24LE;
+ return PA_SAMPLE_S24_32LE;
else if (strcasecmp(format, "s24-32be") == 0)
- return PA_SAMPLE_S24BE;
+ return PA_SAMPLE_S24_32BE;
else if (strcasecmp(format, "s24-32ne") == 0 || strcasecmp(format, "s24-32") == 0)
- return PA_SAMPLE_S24NE;
+ return PA_SAMPLE_S24_32NE;
else if (strcasecmp(format, "s24-32re") == 0)
- return PA_SAMPLE_S24RE;
+ return PA_SAMPLE_S24_32RE;
return -1;
}
commit 947bf5de6c7eaa1edc701f3f959dc16e091082dc
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:12:45 2009 +0200
zeroconf: properly unref native protocol object
diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c
index 4f382c8..d72d264 100644
--- a/src/modules/module-zeroconf-publish.c
+++ b/src/modules/module-zeroconf-publish.c
@@ -695,6 +695,9 @@ void pa__done(pa_module*m) {
if (u->avahi_poll)
pa_avahi_poll_free(u->avahi_poll);
+ if (u->native)
+ pa_native_protocol_unref(u->native);
+
pa_xfree(u->service_name);
pa_xfree(u);
}
commit 076830af191306e0f6e5c6c783042345fcbca2be
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:13:15 2009 +0200
endian: fix LE/BE order for 24 bit accessor functions
diff --git a/src/pulsecore/endianmacros.h b/src/pulsecore/endianmacros.h
index 2257937..2b18cf8 100644
--- a/src/pulsecore/endianmacros.h
+++ b/src/pulsecore/endianmacros.h
@@ -45,27 +45,27 @@
#define PA_UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) (x) >> 24) | ((uint32_t) (x) << 24) | (((uint32_t) (x) & 0xFF00) << 8) | ((((uint32_t) (x)) >> 8) & 0xFF00) ) )
#endif
-static inline uint32_t PA_READ24LE(const uint8_t *p) {
+static inline uint32_t PA_READ24BE(const uint8_t *p) {
return
((uint32_t) p[0] << 16) |
((uint32_t) p[1] << 8) |
((uint32_t) p[2]);
}
-static inline uint32_t PA_READ24BE(const uint8_t *p) {
+static inline uint32_t PA_READ24LE(const uint8_t *p) {
return
((uint32_t) p[2] << 16) |
((uint32_t) p[1] << 8) |
((uint32_t) p[0]);
}
-static inline void PA_WRITE24LE(uint8_t *p, uint32_t u) {
+static inline void PA_WRITE24BE(uint8_t *p, uint32_t u) {
p[0] = (uint8_t) (u >> 16);
p[1] = (uint8_t) (u >> 8);
p[2] = (uint8_t) u;
}
-static inline void PA_WRITE24BE(uint8_t *p, uint32_t u) {
+static inline void PA_WRITE24LE(uint8_t *p, uint32_t u) {
p[2] = (uint8_t) (u >> 16);
p[1] = (uint8_t) (u >> 8);
p[0] = (uint8_t) u;
commit 3a7b287c7ebd4e1b23ab076700201d0acb5a00c2
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:14:02 2009 +0200
sample-util: properly allocate silence block for s24-32 formats
diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index 3a9b384..007a2f0 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -1181,6 +1181,8 @@ pa_memchunk* pa_silence_memchunk_get(pa_silence_cache *cache, pa_mempool *pool,
case PA_SAMPLE_S32BE:
case PA_SAMPLE_S24LE:
case PA_SAMPLE_S24BE:
+ case PA_SAMPLE_S24_32LE:
+ case PA_SAMPLE_S24_32RE:
case PA_SAMPLE_FLOAT32LE:
case PA_SAMPLE_FLOAT32BE:
cache->blocks[PA_SAMPLE_S16LE] = b = silence_memblock_new(pool, 0);
@@ -1189,6 +1191,8 @@ pa_memchunk* pa_silence_memchunk_get(pa_silence_cache *cache, pa_mempool *pool,
cache->blocks[PA_SAMPLE_S32BE] = pa_memblock_ref(b);
cache->blocks[PA_SAMPLE_S24LE] = pa_memblock_ref(b);
cache->blocks[PA_SAMPLE_S24BE] = pa_memblock_ref(b);
+ cache->blocks[PA_SAMPLE_S24_32LE] = pa_memblock_ref(b);
+ cache->blocks[PA_SAMPLE_S24_32BE] = pa_memblock_ref(b);
cache->blocks[PA_SAMPLE_FLOAT32LE] = pa_memblock_ref(b);
cache->blocks[PA_SAMPLE_FLOAT32BE] = pa_memblock_ref(b);
break;
commit d2b5ae5525e9036c4f91b1615879a5a07aac5bf2
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:14:40 2009 +0200
sample-util: fix iteration loop when adjusting volume of s24 samples
diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index 007a2f0..dda3883 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -831,9 +831,9 @@ void pa_volume_memchunk(
calc_linear_integer_volume(linear, volume);
- e = (uint8_t*) ptr + c->length/3;
+ e = (uint8_t*) ptr + c->length;
- for (channel = 0, d = ptr; d < e; d++) {
+ for (channel = 0, d = ptr; d < e; d += 3) {
int64_t t;
t = (int64_t)((int32_t) (PA_READ24NE(d) << 8));
@@ -854,9 +854,9 @@ void pa_volume_memchunk(
calc_linear_integer_volume(linear, volume);
- e = (uint8_t*) ptr + c->length/3;
+ e = (uint8_t*) ptr + c->length;
- for (channel = 0, d = ptr; d < e; d++) {
+ for (channel = 0, d = ptr; d < e; d += 3) {
int64_t t;
t = (int64_t)((int32_t) (PA_READ24RE(d) << 8));
commit 4bffc7849f7898fa85dd6ac8e735db86b57814b3
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:16:17 2009 +0200
alsa: initialize buffer size before number of periods to improve compat with some backends
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
index a3a0450..107bec3 100644
--- a/src/modules/alsa/alsa-util.c
+++ b/src/modules/alsa/alsa-util.c
@@ -334,7 +334,6 @@ int pa_alsa_set_hw_params(
int ret = -1;
snd_pcm_uframes_t _period_size = period_size ? *period_size : 0;
unsigned int _periods = periods ? *periods : 0;
- snd_pcm_uframes_t buffer_size;
unsigned int r = ss->rate;
unsigned int c = ss->channels;
pa_sample_format_t f = ss->format;
@@ -390,39 +389,47 @@ int pa_alsa_set_hw_params(
goto finish;
if (_period_size && tsched_size && _periods) {
+
/* Adjust the buffer sizes, if we didn't get the rate we were asking for */
_period_size = (snd_pcm_uframes_t) (((uint64_t) _period_size * r) / ss->rate);
tsched_size = (snd_pcm_uframes_t) (((uint64_t) tsched_size * r) / ss->rate);
if (_use_tsched) {
- _period_size = tsched_size;
- _periods = 1;
+ snd_pcm_uframes_t buffer_size;
pa_assert_se(snd_pcm_hw_params_get_buffer_size_max(hwparams, &buffer_size) == 0);
pa_log_debug("Maximum hw buffer size is %u ms", (unsigned) buffer_size * 1000 / r);
+
+ _period_size = tsched_size;
+ _periods = 1;
}
- buffer_size = _periods * _period_size;
+ if (_period_size > 0 && _periods > 0) {
+ snd_pcm_uframes_t buffer_size;
+
+ buffer_size = _periods * _period_size;
+
+ if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0)
+ pa_log_info("snd_pcm_hw_params_set_buffer_size_near() failed: %s", pa_alsa_strerror(ret));
+ }
if (_periods > 0) {
- /* First we pass 0 as direction to get exactly what we asked
- * for. That this is necessary is presumably a bug in ALSA */
+ /* First we pass 0 as direction to get exactly what we
+ * asked for. That this is necessary is presumably a bug
+ * in ALSA. All in all this is mostly a hint to ALSA, so
+ * we don't care if this fails. */
dir = 0;
- if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) {
+ if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) {
dir = 1;
- if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0) {
+ if (snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir) < 0) {
dir = -1;
if ((ret = snd_pcm_hw_params_set_periods_near(pcm_handle, hwparams, &_periods, &dir)) < 0)
- goto finish;
+ pa_log_info("snd_pcm_hw_params_set_periods_near() failed: %s", pa_alsa_strerror(ret));
}
}
}
-
- if (_period_size > 0)
- if ((ret = snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hwparams, &buffer_size)) < 0)
- goto finish;
}
if ((ret = snd_pcm_hw_params(pcm_handle, hwparams)) < 0)
commit 76caa270cecd15d046969888f55f09101df7fc27
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:17:34 2009 +0200
resampler-test: use global PA_FLOAT32_SWAP implementation
diff --git a/src/tests/resampler-test.c b/src/tests/resampler-test.c
index 6b4a64c..596070f 100644
--- a/src/tests/resampler-test.c
+++ b/src/tests/resampler-test.c
@@ -34,12 +34,6 @@
#include <liboil/liboil.h>
-static float swap_float(float a) {
- uint32_t *b = (uint32_t*) &a;
- *b = PA_UINT32_SWAP(*b);
- return a;
-}
-
static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
void *d;
unsigned i;
@@ -84,7 +78,7 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
float *u = d;
for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
- printf("%1.3g ", ss->format == PA_SAMPLE_FLOAT32NE ? *u : swap_float(*u));
+ printf("%4.3g ", ss->format == PA_SAMPLE_FLOAT32NE ? *u : PA_FLOAT32_SWAP(*u));
u++;
}
@@ -179,7 +173,7 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) {
if (ss->format == PA_SAMPLE_FLOAT32RE)
for (i = 0; i < 10; i++)
- u[i] = swap_float(u[i]);
+ u[i] = PA_FLOAT32_SWAP(u[i]);
break;
}
commit 5caf09d4ea5ec8f40f56adf965fc4a0011b8b97c
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:18:21 2009 +0200
resampler-test: add tests for 24bit sample formats
diff --git a/src/tests/resampler-test.c b/src/tests/resampler-test.c
index 596070f..7236265 100644
--- a/src/tests/resampler-test.c
+++ b/src/tests/resampler-test.c
@@ -48,7 +48,7 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
uint8_t *u = d;
for (i = 0; i < chunk->length / pa_frame_size(ss); i++)
- printf("0x%02x ", *(u++));
+ printf(" 0x%02x ", *(u++));
break;
}
@@ -58,7 +58,7 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
uint16_t *u = d;
for (i = 0; i < chunk->length / pa_frame_size(ss); i++)
- printf("0x%04x ", *(u++));
+ printf(" 0x%04x ", *(u++));
break;
}
@@ -73,6 +73,16 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
break;
}
+ case PA_SAMPLE_S24_32NE:
+ case PA_SAMPLE_S24_32RE: {
+ uint32_t *u = d;
+
+ for (i = 0; i < chunk->length / pa_frame_size(ss); i++)
+ printf("0x%08x ", *(u++));
+
+ break;
+ }
+
case PA_SAMPLE_FLOAT32NE:
case PA_SAMPLE_FLOAT32RE: {
float *u = d;
@@ -85,6 +95,18 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
break;
}
+ case PA_SAMPLE_S24LE:
+ case PA_SAMPLE_S24BE: {
+ uint8_t *u = d;
+
+ for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
+ printf(" 0x%06x ", PA_READ24NE(u));
+ u += pa_frame_size(ss);
+ }
+
+ break;
+ }
+
default:
pa_assert_not_reached();
}
@@ -156,6 +178,23 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) {
break;
}
+ case PA_SAMPLE_S24_32NE:
+ case PA_SAMPLE_S24_32RE: {
+ uint32_t *u = d;
+
+ u[0] = 0x000001;
+ u[1] = 0xFF0002;
+ u[2] = 0x7F0003;
+ u[3] = 0x800004;
+ u[4] = 0x9f0005;
+ u[5] = 0x3f0006;
+ u[6] = 0x107;
+ u[7] = 0xF00008;
+ u[8] = 0x2009;
+ u[9] = 0x210A;
+ break;
+ }
+
case PA_SAMPLE_FLOAT32NE:
case PA_SAMPLE_FLOAT32RE: {
float *u = d;
@@ -178,6 +217,23 @@ static pa_memblock* generate_block(pa_mempool *pool, const pa_sample_spec *ss) {
break;
}
+ case PA_SAMPLE_S24NE:
+ case PA_SAMPLE_S24RE: {
+ uint8_t *u = d;
+
+ PA_WRITE24NE(u, 0x000001);
+ PA_WRITE24NE(u+3, 0xFF0002);
+ PA_WRITE24NE(u+6, 0x7F0003);
+ PA_WRITE24NE(u+9, 0x800004);
+ PA_WRITE24NE(u+12, 0x9f0005);
+ PA_WRITE24NE(u+15, 0x3f0006);
+ PA_WRITE24NE(u+18, 0x107);
+ PA_WRITE24NE(u+21, 0xF00008);
+ PA_WRITE24NE(u+24, 0x2009);
+ PA_WRITE24NE(u+27, 0x210A);
+ break;
+ }
+
default:
pa_assert_not_reached();
}
@@ -205,7 +261,6 @@ int main(int argc, char *argv[]) {
for (a.format = 0; a.format < PA_SAMPLE_MAX; a.format ++) {
for (b.format = 0; b.format < PA_SAMPLE_MAX; b.format ++) {
-
pa_resampler *forth, *back;
pa_memchunk i, j, k;
@@ -223,14 +278,18 @@ int main(int argc, char *argv[]) {
pa_resampler_run(forth, &i, &j);
pa_resampler_run(back, &j, &k);
+ printf("before: ");
dump_block(&a, &i);
+ printf("after : ");
dump_block(&b, &j);
+ printf("reverse: ");
dump_block(&a, &k);
pa_memblock_unref(j.memblock);
pa_memblock_unref(k.memblock);
pa_volume_memchunk(&i, &a, &v);
+ printf("volume: ");
dump_block(&a, &i);
pa_memblock_unref(i.memblock);
commit e0f08219bb6b5ed9fd92623997074410051ed671
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri May 1 04:22:08 2009 +0200
sconv: fix a few minor conversion issues
diff --git a/src/pulsecore/sconv-s16le.c b/src/pulsecore/sconv-s16le.c
index 307ce7b..43b8cb3 100644
--- a/src/pulsecore/sconv-s16le.c
+++ b/src/pulsecore/sconv-s16le.c
@@ -370,7 +370,7 @@ void pa_sconv_s24_32le_to_s16ne(unsigned n, const uint32_t *a, int16_t *b) {
pa_assert(b);
for (; n > 0; n--) {
- *b = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8) >> 16);
+ *b = (int16_t) (((int32_t) (UINT32_FROM(*a) << 8)) >> 16);
a++;
b++;
}
@@ -416,8 +416,8 @@ void pa_sconv_s24_32le_to_float32ne(unsigned n, const uint32_t *a, float *b) {
pa_assert(b);
for (; n > 0; n--) {
- int32_t s = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8));
- *b = ((float) s) / 0x7FFFFFFF;
+ int32_t s = (int32_t) (UINT32_FROM(*a) << 8);
+ *b = (float) s / (float) 0x7FFFFFFF;
a ++;
b ++;
}
@@ -428,8 +428,8 @@ void pa_sconv_s24_32le_to_float32re(unsigned n, const uint32_t *a, float *b) {
pa_assert(b);
for (; n > 0; n--) {
- int32_t s = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8));
- float k = ((float) s) / 0x7FFFFFFF;
+ int32_t s = (int32_t) (UINT32_FROM(*a) << 8);
+ float k = (float) s / (float) 0x7FFFFFFF;
*b = PA_FLOAT32_SWAP(k);
a ++;
b ++;
diff --git a/src/pulsecore/sconv.c b/src/pulsecore/sconv.c
index 29a9a45..d89f428 100644
--- a/src/pulsecore/sconv.c
+++ b/src/pulsecore/sconv.c
@@ -75,7 +75,7 @@ static void u8_from_s16ne(unsigned n, const int16_t *a, uint8_t *b) {
pa_assert(b);
for (; n > 0; n--, a++, b++)
- *b = (uint8_t) (*a / 0x100 + 0x80);
+ *b = (uint8_t) ((uint16_t) *a >> 8) + (uint8_t) 0x80U;
}
/* float32 */
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list