[vlc-commits] ALSA: do not prepend zeroes for S/PDIF, sleep instead
Rémi Denis-Courmont
git at videolan.org
Tue Dec 6 21:36:36 CET 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Dec 6 22:36:10 2011 +0200| [bcd564d488c01cf3702577ca63d26f743dfa2f24] | committer: Rémi Denis-Courmont
ALSA: do not prepend zeroes for S/PDIF, sleep instead
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bcd564d488c01cf3702577ca63d26f743dfa2f24
---
modules/audio_output/alsa.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index ed1caa5..e948efb 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -602,7 +602,7 @@ static void Play (audio_output_t *aout, block_t *block)
if (state != SND_PCM_STATE_RUNNING)
{
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;
msg_Dbg (aout, "prepending %ld zeroes", frames);
@@ -612,8 +612,12 @@ static void Play (audio_output_t *aout, block_t *block)
{
snd_pcm_writei (pcm, pad, frames);
free (pad);
+ delay = 0;
}
}
+ /* Lame fallback if zero padding does not work */
+ if (delay > 0)
+ mwait (block->i_pts - delay);
}
else
aout_TimeReport (aout, block->i_pts - delay);
More information about the vlc-commits
mailing list