summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/decode/ad_lavc.c4
-rw-r--r--audio/filter/af_export.c4
-rw-r--r--audio/out/ao_alsa.c4
3 files changed, 7 insertions, 5 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index ac72d62212..8553e93cf1 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -192,11 +192,11 @@ static int init(sh_audio_t *sh_audio)
mp_msg(MSGT_DECAUDIO, MSGL_V, "INFO: libavcodec \"%s\" init OK!\n",
lavc_codec->name);
- if (sh_audio->format == 0x3343414D) {
+ if (sh_audio->wf && sh_audio->format == 0x3343414D) {
// MACE 3:1
sh_audio->ds->ss_div = 2 * 3; // 1 samples/packet
sh_audio->ds->ss_mul = 2 * sh_audio->wf->nChannels; // 1 byte*ch/packet
- } else if (sh_audio->format == 0x3643414D) {
+ } else if (sh_audio->wf && sh_audio->format == 0x3643414D) {
// MACE 6:1
sh_audio->ds->ss_div = 2 * 6; // 1 samples/packet
sh_audio->ds->ss_mul = 2 * sh_audio->wf->nChannels; // 1 byte*ch/packet
diff --git a/audio/filter/af_export.c b/audio/filter/af_export.c
index 2e25d8a642..2687904ebd 100644
--- a/audio/filter/af_export.c
+++ b/audio/filter/af_export.c
@@ -103,9 +103,11 @@ static int control(struct af_instance* af, int cmd, void* arg)
// Init memory mapping
s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640);
mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);
- if(s->fd < 0)
+ if(s->fd < 0) {
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not open/create file: %s\n",
s->filename);
+ return AF_ERROR;
+ }
// header + buffer
mapsize = (SIZE_HEADER + (af->data->bps * s->sz * af->data->nch));
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index cd50a1c1d5..4fe744320b 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -818,13 +818,13 @@ static int play(void* data, int len, int flags)
mp_tmsg(MSGT_AO,MSGL_INFO,"[AO_ALSA] Trying to reset soundcard.\n");
if ((res = snd_pcm_prepare(alsa_handler)) < 0) {
mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm prepare error: %s\n", snd_strerror(res));
- return 0;
break;
}
+ res = 0;
}
} while (res == 0);
- return res < 0 ? res : res * bytes_per_sample;
+ return res < 0 ? 0 : res * bytes_per_sample;
}
/* how many byes are free in the buffer */