[vlc-commits] PulseAudio: work around #5825

Rémi Denis-Courmont git at videolan.org
Wed May 16 16:52:51 CEST 2012


vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 16 17:51:59 2012 +0300| [c87880bc4e5a90febbfc348dfb01150a5d113632] | committer: Rémi Denis-Courmont

PulseAudio: work around #5825

This bug is already fixed in VLC 2.1, but the fix is probably too
invasive to be backported.

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=c87880bc4e5a90febbfc348dfb01150a5d113632
---

 modules/audio_output/pulse.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index b081edd..13d8384 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -511,6 +511,8 @@ static void *data_convert(block_t **pp)
     return block->p_buffer;
 }
 
+static void Pause(audio_output_t *, bool, mtime_t);
+
 /**
  * Queue one audio frame to the playabck stream
  */
@@ -533,6 +535,13 @@ static void Play(audio_output_t *aout, block_t *block)
      * will take place, and sooner or later a deadlock. */
     pa_threaded_mainloop_lock(sys->mainloop);
 
+    /* Work around decoder core bug (play without/before resume) */
+    while (unlikely(sys->paused != VLC_TS_INVALID)) {
+        pa_threaded_mainloop_unlock(sys->mainloop);
+        Pause(aout, false, mdate());
+        pa_threaded_mainloop_lock(sys->mainloop);
+    }
+
     sys->pts = pts;
     if (pa_stream_is_corked(s) > 0)
         stream_resync(aout, s);
@@ -566,6 +575,9 @@ static void Pause(audio_output_t *aout, bool paused, mtime_t date)
     if (paused) {
         sys->paused = date;
         stream_stop(s, aout);
+    } else if (unlikely(sys->paused == VLC_TS_INVALID)) {
+        /* Work around decoder core bug (play before resume) */
+        msg_Warn(aout, "pause state confusion");
     } else {
         assert (sys->paused != VLC_TS_INVALID);
         date -= sys->paused;



More information about the vlc-commits mailing list