set the nearest number of channels, return(0) upon errors

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16309 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
henry 2005-08-25 19:57:32 +00:00
parent 341e1c97e9
commit 4b40fd60f0
1 changed files with 4 additions and 2 deletions

View File

@ -548,13 +548,15 @@ static int init(int rate_hz, int channels, int format, int flags)
{
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set format: %s\n",
snd_strerror(err));
return(0);
}
if ((err = snd_pcm_hw_params_set_channels(alsa_handler, alsa_hwparams,
ao_data.channels)) < 0)
if ((err = snd_pcm_hw_params_set_channels_near(alsa_handler, alsa_hwparams,
&ao_data.channels)) < 0)
{
mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: unable to set channels: %s\n",
snd_strerror(err));
return(0);
}
if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams,