comparison libao2/ao_alsa.c @ 24590:2c238fa777ff

ao_alsa: Fix get_space() return values larger than buffersize After a buffer underrun the ALSA get_space() function sometimes returned values larger than the ao had set in ao_data.buffersize. Fix this by replacing the old check against MAX_OUTBURST by one against ao_data.buffersize. There should be no need for the MAX_OUTBURST check; the current MPlayer side should no longer have any constant limit on the amount of data an ao can buffer or request at once. The get_space() values larger than ao_data.buffersize triggered errors in audio decoding causing the current attempt to fill audio buffers to be aborted. I'm not sure how often that caused behavior noticeably worse then an underrun already is.
author uau
date Mon, 24 Sep 2007 21:49:58 +0000
parents 68dceb30bbcf
children 0fdf04b07ecb
comparison
equal deleted inserted replaced
24589:9118be6575da 24590:2c238fa777ff
859 mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_CannotGetPcmStatus, snd_strerror(ret)); 859 mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_CannotGetPcmStatus, snd_strerror(ret));
860 return(0); 860 return(0);
861 } 861 }
862 862
863 ret = snd_pcm_status_get_avail(status) * bytes_per_sample; 863 ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
864 if (ret > MAX_OUTBURST) 864 if (ret > ao_data.buffersize) // Buffer underrun?
865 ret = MAX_OUTBURST; 865 ret = ao_data.buffersize;
866 return(ret); 866 return(ret);
867 } 867 }
868 868
869 /* delay in seconds between first and last sample in buffer */ 869 /* delay in seconds between first and last sample in buffer */
870 static float get_delay(void) 870 static float get_delay(void)