Commit 642610c6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

ALSA: do not prepend zeroes for S/PDIF, sleep instead

(cherry picked from commit bcd564d488c01cf3702577ca63d26f743dfa2f24)
parent 9af556d2
...@@ -602,7 +602,7 @@ static void Play (audio_output_t *aout, block_t *block) ...@@ -602,7 +602,7 @@ static void Play (audio_output_t *aout, block_t *block)
if (state != SND_PCM_STATE_RUNNING) if (state != SND_PCM_STATE_RUNNING)
{ {
delay = block->i_pts - (mdate () + delay); delay = block->i_pts - (mdate () + delay);
if (delay > 0) if (delay > 0 && aout->format.i_format != VLC_CODEC_SPDIFL)
{ {
frames = (delay * aout->format.i_rate) / CLOCK_FREQ; frames = (delay * aout->format.i_rate) / CLOCK_FREQ;
msg_Dbg (aout, "prepending %ld zeroes", frames); msg_Dbg (aout, "prepending %ld zeroes", frames);
...@@ -612,8 +612,12 @@ static void Play (audio_output_t *aout, block_t *block) ...@@ -612,8 +612,12 @@ static void Play (audio_output_t *aout, block_t *block)
{ {
snd_pcm_writei (pcm, pad, frames); snd_pcm_writei (pcm, pad, frames);
free (pad); free (pad);
delay = 0;
} }
} }
/* Lame fallback if zero padding does not work */
if (delay > 0)
mwait (block->i_pts - delay);
} }
else else
aout_TimeReport (aout, block->i_pts - delay); aout_TimeReport (aout, block->i_pts - delay);
......
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