diff options
author | cladisch <cladisch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-09-18 16:29:27 +0000 |
---|---|---|
committer | cladisch <cladisch@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-09-18 16:29:27 +0000 |
commit | ec56167e117122e379e1d19b121686dbf0b3dca3 (patch) | |
tree | fea02d1d1fda880f31f5911774cf2f6946fb4896 | |
parent | 01b53ae33506194c5798c0af2f4c8c9009c8c68f (diff) |
When one of the PCM configuration function in init() fails, abort
immediately instead of continuing with the remaining calls that would
fail anyway because the device or some variable wasn't properly
initialized in this case.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19893 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libao2/ao_alsa.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 7063d7a709..c308bf2706 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -577,6 +577,7 @@ static int init(int rate_hz, int channels, int format, int flags) { mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set period time: %s\n", snd_strerror(err)); + return 0; } mp_msg(MSGT_AO,MSGL_INFO,"alsa-init: buffer_time: %d, period_time :%d\n", alsa_buffer_time, err); @@ -591,6 +592,7 @@ static int init(int rate_hz, int channels, int format, int flags) { mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set periodsize(%ld): %s\n", chunk_size, snd_strerror(err)); + return 0; } else { mp_msg(MSGT_AO,MSGL_V,"alsa-init: chunksize set to %li\n", chunk_size); @@ -599,6 +601,7 @@ static int init(int rate_hz, int channels, int format, int flags) &alsa_fragcount, NULL)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set periods: %s\n", snd_strerror(err)); + return 0; } else { mp_msg(MSGT_AO,MSGL_V,"alsa-init: fragcount=%i\n", alsa_fragcount); @@ -611,6 +614,7 @@ static int init(int rate_hz, int channels, int format, int flags) { mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set hw-parameters: %s\n", snd_strerror(err)); + return 0; } // end setting hw-params @@ -619,6 +623,7 @@ static int init(int rate_hz, int channels, int format, int flags) if ((err = snd_pcm_hw_params_get_buffer_size(alsa_hwparams, &bufsize)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to get buffersize: %s\n", snd_strerror(err)); + return 0; } else { ao_data.buffersize = bufsize * bytes_per_sample; @@ -627,6 +632,7 @@ static int init(int rate_hz, int channels, int format, int flags) if ((err = snd_pcm_hw_params_get_period_size(alsa_hwparams, &chunk_size, NULL)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to get period size: %s\n", snd_strerror(err)); + return 0; } else { mp_msg(MSGT_AO,MSGL_V,"alsa-init: got period size %li\n", chunk_size); } |