mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
deal with a possibly failing pa_channel_map_init_auto() correctly
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2105 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
a3e820fca7
commit
86b9ef8c96
13 changed files with 39 additions and 18 deletions
|
|
@ -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);
|
||||
|
|
@ -54,6 +55,9 @@ pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *
|
|||
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);
|
||||
s->context = c;
|
||||
|
|
@ -81,13 +85,9 @@ pa_stream *pa_stream_new(pa_context *c, const char *name, const pa_sample_spec *
|
|||
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;
|
||||
s->syncid = c->csyncid++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue