[pulseaudio-commits] r2105 - in /trunk/src: modules/ pulse/ pulsecore/
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Wed Feb 13 14:13:46 PST 2008
Author: lennart
Date: Wed Feb 13 23:13:44 2008
New Revision: 2105
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2105&root=pulseaudio&view=rev
Log:
deal with a possibly failing pa_channel_map_init_auto() correctly
Modified:
trunk/src/modules/alsa-util.c
trunk/src/modules/module-combine.c
trunk/src/modules/module-jack-sink.c
trunk/src/modules/module-jack-source.c
trunk/src/modules/module-zeroconf-discover.c
trunk/src/pulse/stream.c
trunk/src/pulsecore/core-scache.c
trunk/src/pulsecore/resampler.c
trunk/src/pulsecore/sink-input.c
trunk/src/pulsecore/sink.c
trunk/src/pulsecore/sound-file.c
trunk/src/pulsecore/source-output.c
trunk/src/pulsecore/source.c
Modified: trunk/src/modules/alsa-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/alsa-util.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/modules/alsa-util.c (original)
+++ trunk/src/modules/alsa-util.c Wed Feb 13 23:13:44 2008
@@ -615,8 +615,10 @@
*dev = d;
- if (ss->channels != map->channels)
+ if (ss->channels != map->channels) {
+ pa_assert_se(pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_AUX));
pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_ALSA);
+ }
return pcm_handle;
}
Modified: trunk/src/modules/module-combine.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-combine.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/modules/module-combine.c (original)
+++ trunk/src/modules/module-combine.c Wed Feb 13 23:13:44 2008
@@ -988,8 +988,10 @@
if (master_sink && ss.channels == master_sink->sample_spec.channels)
map = master_sink->channel_map;
- else
+ else {
+ pa_assert_se(pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_AUX));
pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_DEFAULT);
+ }
if ((pa_modargs_get_channel_map(ma, NULL, &map) < 0)) {
pa_log("Invalid channel map.");
Modified: trunk/src/modules/module-jack-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-jack-sink.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/modules/module-jack-sink.c (original)
+++ trunk/src/modules/module-jack-sink.c Wed Feb 13 23:13:44 2008
@@ -333,6 +333,7 @@
goto fail;
}
+ pa_assert_se(pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_AUX));
pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_ALSA);
if (pa_modargs_get_channel_map(ma, NULL, &map) < 0 || map.channels != channels) {
pa_log("Failed to parse channel_map= argument.");
Modified: trunk/src/modules/module-jack-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-jack-source.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/modules/module-jack-source.c (original)
+++ trunk/src/modules/module-jack-source.c Wed Feb 13 23:13:44 2008
@@ -304,6 +304,7 @@
goto fail;
}
+ pa_assert_se(pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_AUX));
pa_channel_map_init_auto(&map, channels, PA_CHANNEL_MAP_ALSA);
if (pa_modargs_get_channel_map(ma, NULL, &map) < 0 || map.channels != channels) {
pa_log("failed to parse channel_map= argument.");
Modified: trunk/src/modules/module-zeroconf-discover.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/modules/module-zeroconf-discover.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/modules/module-zeroconf-discover.c (original)
+++ trunk/src/modules/module-zeroconf-discover.c Wed Feb 13 23:13:44 2008
@@ -164,6 +164,7 @@
pa_module *m;
ss = u->core->default_sample_spec;
+ pa_assert_se(pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_AUX));
pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_DEFAULT);
for (l = txt; l; l = l->next) {
@@ -189,8 +190,10 @@
avahi_free(value);
}
- if (!channel_map_set && cm.channels != ss.channels)
+ if (!channel_map_set && cm.channels != ss.channels) {
+ pa_assert_se(pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_AUX));
pa_channel_map_init_auto(&cm, ss.channels, PA_CHANNEL_MAP_DEFAULT);
+ }
if (!pa_sample_spec_valid(&ss)) {
pa_log("Service '%s' contains an invalid sample specification.", name);
Modified: trunk/src/pulse/stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulse/stream.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulse/stream.c (original)
+++ trunk/src/pulse/stream.c Wed Feb 13 23:13:44 2008
@@ -46,6 +46,7 @@
pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *ss, const pa_channel_map *map) {
pa_stream *s;
int i;
+ pa_channel_map tmap;
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
@@ -53,6 +54,9 @@
PA_CHECK_VALIDITY_RETURN_NULL(c, ss && pa_sample_spec_valid(ss), PA_ERR_INVALID);
PA_CHECK_VALIDITY_RETURN_NULL(c, c->version >= 12 || (ss->format != PA_SAMPLE_S32LE || ss->format != PA_SAMPLE_S32NE), PA_ERR_NOTSUPPORTED);
PA_CHECK_VALIDITY_RETURN_NULL(c, !map || (pa_channel_map_valid(map) && map->channels == ss->channels), PA_ERR_INVALID);
+
+ if (!map)
+ PA_CHECK_VALIDITY_RETURN_NULL(c, map = pa_channel_map_init_auto(&tmap, ss->channels, PA_CHANNEL_MAP_DEFAULT), PA_ERR_INVALID);
s = pa_xnew(pa_stream, 1);
PA_REFCNT_INIT(s);
@@ -81,12 +85,8 @@
s->direction = PA_STREAM_NODIRECTION;
s->name = pa_xstrdup(name);
s->sample_spec = *ss;
+ s->channel_map = *map;
s->flags = 0;
-
- if (map)
- s->channel_map = *map;
- else
- pa_channel_map_init_auto(&s->channel_map, ss->channels, PA_CHANNEL_MAP_DEFAULT);
s->channel = 0;
s->channel_valid = 0;
Modified: trunk/src/pulsecore/core-scache.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/core-scache.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulsecore/core-scache.c (original)
+++ trunk/src/pulsecore/core-scache.c Wed Feb 13 23:13:44 2008
@@ -145,19 +145,28 @@
int pa_scache_add_item(pa_core *c, const char *name, const pa_sample_spec *ss, const pa_channel_map *map, const pa_memchunk *chunk, uint32_t *idx) {
pa_scache_entry *e;
char st[PA_SAMPLE_SPEC_SNPRINT_MAX];
-
- pa_assert(c);
- pa_assert(name);
+ pa_channel_map tmap;
+
+ pa_assert(c);
+ pa_assert(name);
+ pa_assert(!ss || pa_sample_spec_valid(ss));
+ pa_assert(!map || (pa_channel_map_valid(map) && ss && ss->channels == map->channels));
+
+ if (ss && !map)
+ if (!(map = pa_channel_map_init_auto(&tmap, ss->channels, PA_CHANNEL_MAP_DEFAULT)))
+ return -1;
if (chunk && chunk->length > PA_SCACHE_ENTRY_SIZE_MAX)
return -1;
if (!(e = scache_add_item(c, name)))
return -1;
+
+ memset(&e->sample_spec, 0, sizeof(e->sample_spec));
+ pa_channel_map_init(&e->channel_map);
if (ss) {
e->sample_spec = *ss;
- pa_channel_map_init_auto(&e->channel_map, ss->channels, PA_CHANNEL_MAP_DEFAULT);
e->volume.channels = e->sample_spec.channels;
}
Modified: trunk/src/pulsecore/resampler.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/resampler.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulsecore/resampler.c (original)
+++ trunk/src/pulsecore/resampler.c Wed Feb 13 23:13:44 2008
@@ -217,13 +217,13 @@
if (am)
r->i_cm = *am;
- else
- pa_channel_map_init_auto(&r->i_cm, r->i_ss.channels, PA_CHANNEL_MAP_DEFAULT);
+ else if (!pa_channel_map_init_auto(&r->i_cm, r->i_ss.channels, PA_CHANNEL_MAP_DEFAULT))
+ goto fail;
if (bm)
r->o_cm = *bm;
- else
- pa_channel_map_init_auto(&r->o_cm, r->o_ss.channels, PA_CHANNEL_MAP_DEFAULT);
+ else if (!pa_channel_map_init_auto(&r->o_cm, r->o_ss.channels, PA_CHANNEL_MAP_DEFAULT))
+ goto fail;
r->i_fz = pa_frame_size(a);
r->o_fz = pa_frame_size(b);
Modified: trunk/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink-input.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulsecore/sink-input.c (original)
+++ trunk/src/pulsecore/sink-input.c Wed Feb 13 23:13:44 2008
@@ -120,7 +120,7 @@
if (data->sink->channel_map.channels == data->sample_spec.channels)
data->channel_map = data->sink->channel_map;
else
- pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
+ pa_return_null_if_fail(pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT));
}
pa_return_null_if_fail(pa_channel_map_valid(&data->channel_map));
Modified: trunk/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulsecore/sink.c (original)
+++ trunk/src/pulsecore/sink.c Wed Feb 13 23:13:44 2008
@@ -73,7 +73,7 @@
pa_return_null_if_fail(pa_sample_spec_valid(spec));
if (!map)
- map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT);
+ pa_return_null_if_fail((map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT)));
pa_return_null_if_fail(map && pa_channel_map_valid(map));
pa_return_null_if_fail(map->channels == spec->channels);
Modified: trunk/src/pulsecore/sound-file.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sound-file.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulsecore/sound-file.c (original)
+++ trunk/src/pulsecore/sound-file.c Wed Feb 13 23:13:44 2008
@@ -119,7 +119,10 @@
}
if (map)
- pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_DEFAULT);
+ if (!pa_channel_map_init_auto(map, ss->channels, PA_CHANNEL_MAP_DEFAULT)) {
+ pa_log("Unsupported channel map in file %s", fname);
+ goto finish;
+ }
if ((l = pa_frame_size(ss) * sfinfo.frames) > PA_SCACHE_ENTRY_SIZE_MAX) {
pa_log("File too large");
Modified: trunk/src/pulsecore/source-output.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/source-output.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulsecore/source-output.c (original)
+++ trunk/src/pulsecore/source-output.c Wed Feb 13 23:13:44 2008
@@ -97,7 +97,7 @@
if (data->source->channel_map.channels == data->sample_spec.channels)
data->channel_map = data->source->channel_map;
else
- pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
+ pa_return_null_if_fail(pa_channel_map_init_auto(&data->channel_map, data->sample_spec.channels, PA_CHANNEL_MAP_DEFAULT));
}
pa_return_null_if_fail(pa_channel_map_valid(&data->channel_map));
Modified: trunk/src/pulsecore/source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/source.c?rev=2105&root=pulseaudio&r1=2104&r2=2105&view=diff
==============================================================================
--- trunk/src/pulsecore/source.c (original)
+++ trunk/src/pulsecore/source.c Wed Feb 13 23:13:44 2008
@@ -64,7 +64,7 @@
pa_return_null_if_fail(pa_sample_spec_valid(spec));
if (!map)
- map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT);
+ pa_return_null_if_fail(map = pa_channel_map_init_auto(&tmap, spec->channels, PA_CHANNEL_MAP_DEFAULT));
pa_return_null_if_fail(map && pa_channel_map_valid(map));
pa_return_null_if_fail(map->channels == spec->channels);
More information about the pulseaudio-commits
mailing list