Commit c87880bc authored by Rémi Denis-Courmont's avatar 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.
parent 7127f328
...@@ -511,6 +511,8 @@ static void *data_convert(block_t **pp) ...@@ -511,6 +511,8 @@ static void *data_convert(block_t **pp)
return block->p_buffer; return block->p_buffer;
} }
static void Pause(audio_output_t *, bool, mtime_t);
/** /**
* Queue one audio frame to the playabck stream * Queue one audio frame to the playabck stream
*/ */
...@@ -533,6 +535,13 @@ static void Play(audio_output_t *aout, block_t *block) ...@@ -533,6 +535,13 @@ static void Play(audio_output_t *aout, block_t *block)
* will take place, and sooner or later a deadlock. */ * will take place, and sooner or later a deadlock. */
pa_threaded_mainloop_lock(sys->mainloop); 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; sys->pts = pts;
if (pa_stream_is_corked(s) > 0) if (pa_stream_is_corked(s) > 0)
stream_resync(aout, s); stream_resync(aout, s);
...@@ -566,6 +575,9 @@ static void Pause(audio_output_t *aout, bool paused, mtime_t date) ...@@ -566,6 +575,9 @@ static void Pause(audio_output_t *aout, bool paused, mtime_t date)
if (paused) { if (paused) {
sys->paused = date; sys->paused = date;
stream_stop(s, aout); 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 { } else {
assert (sys->paused != VLC_TS_INVALID); assert (sys->paused != VLC_TS_INVALID);
date -= sys->paused; date -= sys->paused;
......
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