summaryrefslogtreecommitdiff
path: root/plugins/alsa
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-04-30 18:29:49 +0200
committerGravatar waker <wakeroid@gmail.com>2011-04-30 18:29:49 +0200
commita3c4bb806ec13aff63c86fc7c6efee8ca0e8d82c (patch)
treebd11bd72d91021cd1a7448e1c6ff98ac1f0e378a /plugins/alsa
parenta0a69c44d7d6fd56c199b01a42061dd5b5de71e5 (diff)
fixed crash in alsa plugin after bad waveformat error
Diffstat (limited to 'plugins/alsa')
-rw-r--r--plugins/alsa/alsa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index 31c5c3e0..c0be941f 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -468,11 +468,14 @@ palsa_setformat (ddb_waveformat_t *fmt) {
state = OUTPUT_STATE_STOPPED;
snd_pcm_drop (audio);
int ret = palsa_set_hw_params (fmt);
- UNLOCK;
if (ret < 0) {
trace ("palsa_change_rate: impossible to set requested format\n");
+ // even if it failed -- copy the format
+ memcpy (&plugin.fmt, fmt, sizeof (ddb_waveformat_t));
+ UNLOCK;
return -1;
}
+ UNLOCK;
trace ("new format %dbit %s %dch %dHz channelmask=%X\n", plugin.fmt.bps, plugin.fmt.is_float ? "float" : "int", plugin.fmt.channels, plugin.fmt.samplerate, plugin.fmt.channelmask);
switch (s) {