[vlc-commits] ALSA: do not prepend zeroes for S/PDIF, sleep instead

Rémi Denis-Courmont git at videolan.org
Tue Dec 6 21:38:08 CET 2011


vlc/vlc-1.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Dec  6 22:36:10 2011 +0200| [642610c6361405231f6b6717e2c637eb6bb1aada] | committer: Rémi Denis-Courmont

ALSA: do not prepend zeroes for S/PDIF, sleep instead
(cherry picked from commit bcd564d488c01cf3702577ca63d26f743dfa2f24)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=642610c6361405231f6b6717e2c637eb6bb1aada
---

 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