Commit 78cb02e3 authored by Cyril Deguet's avatar Cyril Deguet

* alsa.c: compute next_date with snd_pcm_delay() if snd_pcm_status_get_tstamp

   doesn't work. Better than nothing but the sound is still poor with DVDs :(
parent 1577ef79
......@@ -758,14 +758,27 @@ static void ALSAFill( aout_instance_t * p_aout )
snd_pcm_status_get_tstamp( p_status, &ts_next );
next_date = (mtime_t)ts_next.tv_sec * 1000000 + ts_next.tv_usec;
/* With screwed drivers the timestamp is always zero; then we
* pass a null next_date to aout_OutputNextBuffer to ignore
* resampling */
if( next_date )
{
next_date += (mtime_t)snd_pcm_status_get_delay(p_status)
* 1000000 / p_aout->output.output.i_rate;
}
else
{
/* With screwed ALSA drivers the timestamp is always zero;
* use another method then */
snd_pcm_sframes_t delay;
ssize_t i_bytes = 0;
if( !snd_pcm_delay( p_sys->p_snd_pcm, &delay ) )
{
i_bytes = snd_pcm_frames_to_bytes(p_sys->p_snd_pcm, delay);
}
next_date = mdate() + (mtime_t)i_bytes * 1000000
/ p_aout->output.output.i_bytes_per_frame
/ p_aout->output.output.i_rate
* p_aout->output.output.i_frame_length;
}
}
p_buffer = aout_OutputNextBuffer( p_aout, next_date,
......
......@@ -307,10 +307,8 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
/* Here we suppose that all buffers have the same duration - this is
* generally true, and anyway if it's wrong it won't be a disaster.
* start_date may be null with some screwed ALSA driver; then do not
* try to play silences or resample.
*/
if ( start_date && p_buffer->start_date > start_date
if ( p_buffer->start_date > start_date
+ (p_buffer->end_date - p_buffer->start_date) )
/*
* + AOUT_PTS_TOLERANCE )
......@@ -329,7 +327,7 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout,
p_aout->output.b_starving = 0;
if ( !b_can_sleek && start_date &&
if ( !b_can_sleek &&
( (p_buffer->start_date - start_date > AOUT_PTS_TOLERANCE)
|| (start_date - p_buffer->start_date > AOUT_PTS_TOLERANCE) ) )
{
......
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