mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
* if an ALSA device doesn't support the channel count requested, use what ALSA suggests instead
* if an ALSA device doesn't support the sampling freq requested, use what ALSA suggests and resample if this deviates more than 10% from what we requested * fix segfault freeing an unitialized mixer_fdl field git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@992 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
821a49b967
commit
bb820db4b5
4 changed files with 36 additions and 11 deletions
|
|
@ -363,6 +363,10 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (ss.channels != map.channels)
|
||||
/* Seems ALSA didn't like the channel number, so let's fix the channel map */
|
||||
pa_channel_map_init_auto(&map, ss.channels, PA_CHANNEL_MAP_ALSA);
|
||||
|
||||
if ((err = snd_mixer_open(&u->mixer_handle, 0)) < 0) {
|
||||
pa_log(__FILE__": Error opening mixer: %s", snd_strerror(err));
|
||||
goto fail;
|
||||
|
|
@ -374,8 +378,10 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
u->mixer_handle = NULL;
|
||||
}
|
||||
|
||||
u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map);
|
||||
assert(u->sink);
|
||||
if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, &map))) {
|
||||
pa_log(__FILE__": Failed to create sink object");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
u->sink->get_latency = sink_get_latency_cb;
|
||||
if (u->mixer_handle) {
|
||||
|
|
@ -420,7 +426,8 @@ int pa__init(pa_core *c, pa_module*m) {
|
|||
}
|
||||
snd_mixer_elem_set_callback(u->mixer_elem, mixer_callback);
|
||||
snd_mixer_elem_set_callback_private(u->mixer_elem, u);
|
||||
}
|
||||
} else
|
||||
u->mixer_fdl = NULL;
|
||||
|
||||
u->frame_size = frame_size;
|
||||
u->fragment_size = period_size * frame_size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue