[MPlayer-cvslog] r19893 - trunk/libao2/ao_alsa.c

cladisch subversion at mplayerhq.hu
Mon Sep 18 18:29:27 CEST 2006


Author: cladisch
Date: Mon Sep 18 18:29:27 2006
New Revision: 19893

Modified:
   trunk/libao2/ao_alsa.c

Log:
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.

Modified: trunk/libao2/ao_alsa.c
==============================================================================
--- trunk/libao2/ao_alsa.c	(original)
+++ trunk/libao2/ao_alsa.c	Mon Sep 18 18:29:27 2006
@@ -577,6 +577,7 @@
 	  {
 	    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 @@
 	  {
 	    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 @@
 						      &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 @@
 	{
 	  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 @@
       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 @@
 
       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);
       }



More information about the MPlayer-cvslog mailing list