Commit fcf29754 authored by Benjamin Pracht's avatar Benjamin Pracht

Dirty hack to make devices using snd_intel8x0 drivers happy with 96k streams

parent 4d9b753a
...@@ -304,6 +304,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -304,6 +304,7 @@ static int Open( vlc_object_t *p_this )
int i_snd_rc = -1; int i_snd_rc = -1;
unsigned int i_old_rate; unsigned int i_old_rate;
vlc_bool_t b_retry = VLC_TRUE;
/* Allocate structures */ /* Allocate structures */
p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->output.p_sys = p_sys = malloc( sizeof( aout_sys_t ) );
...@@ -493,6 +494,12 @@ static int Open( vlc_object_t *p_this ) ...@@ -493,6 +494,12 @@ static int Open( vlc_object_t *p_this )
snd_pcm_hw_params_alloca(&p_hw); snd_pcm_hw_params_alloca(&p_hw);
snd_pcm_sw_params_alloca(&p_sw); snd_pcm_sw_params_alloca(&p_sw);
/* Due to some bugs in alsa with some drivers, we need to retry in s16l
if snd_pcm_hw_params fails in fl32 */
while ( b_retry )
{
b_retry = VLC_FALSE;
/* Get Initial hardware parameters */ /* Get Initial hardware parameters */
if ( ( i_snd_rc = snd_pcm_hw_params_any( p_sys->p_snd_pcm, p_hw ) ) < 0 ) if ( ( i_snd_rc = snd_pcm_hw_params_any( p_sys->p_snd_pcm, p_hw ) ) < 0 )
{ {
...@@ -596,11 +603,24 @@ static int Open( vlc_object_t *p_this ) ...@@ -596,11 +603,24 @@ static int Open( vlc_object_t *p_this )
/* Commit hardware parameters. */ /* Commit hardware parameters. */
if ( ( i_snd_rc = snd_pcm_hw_params( p_sys->p_snd_pcm, p_hw ) ) < 0 ) if ( ( i_snd_rc = snd_pcm_hw_params( p_sys->p_snd_pcm, p_hw ) ) < 0 )
{
if ( b_retry == VLC_FALSE &&
i_snd_pcm_format == SND_PCM_FORMAT_FLOAT)
{
b_retry = VLC_TRUE;
i_snd_pcm_format = SND_PCM_FORMAT_S16;
p_aout->output.output.i_format = AOUT_FMT_S16_NE;
msg_Warn( p_aout, "unable to commit hardware configuration "
"with fl32 samples. Retrying with s16l (%s)", snd_strerror( i_snd_rc ) );
}
else
{ {
msg_Err( p_aout, "unable to commit hardware configuration (%s)", msg_Err( p_aout, "unable to commit hardware configuration (%s)",
snd_strerror( i_snd_rc ) ); snd_strerror( i_snd_rc ) );
goto error; goto error;
} }
}
}
#ifdef HAVE_ALSA_NEW_API #ifdef HAVE_ALSA_NEW_API
if( ( i_snd_rc = snd_pcm_hw_params_get_period_time( p_hw, if( ( i_snd_rc = snd_pcm_hw_params_get_period_time( p_hw,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment