<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head></head><body><div style="font-size: 12pt; font-family: Calibri,sans-serif;"><div>It was already pointed out a few weeks ago that this approach is wrong, because underflow can occur during normal playback.</div><div><br></div><div>-- </div><div>Rémi Denis-Courmont</div><div>Sent from my NVIDIA Tegra-powered device</div><br><div id="htc_header">----- Reply message -----<br>De : "Thomas Guillem" <thomas@gllm.fr><br>Pour : <vlc-devel@videolan.org><br>Objet : [vlc-devel] [RFC PATCH] PulseAudio: fix audio drop after an    underflow<br>Date : ven., avr. 17, 2015 16:29</div></div><br><pre style="word-wrap: break-word; white-space: pre-wrap;">This fixes audio drop when the track has a positive delay.
---
Hi,

I'm trying to fix an issue with Pulse Audio when changing the audio track
synchronization. Indeed, you can loose audio when you seek after selecting a
positive delay. I think it happens because we wait too long between the last
pa_stream_cork/pa_stream_flush and the first pa_stream_write.

I'm not sure if this is the best way to fix this issue.

An other way to fix this issue is to pause pulse after a flush and start it
again before the next write.

How to reproduce:
$ ./vlc --audio-desync=2500 <video>
Audio will start playing after a delay of 2500ms, but if you seek, you'll loose
audio.

 modules/audio_output/pulse.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 5947ceb..1284097 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -351,9 +351,13 @@ static void stream_suspended_cb(pa_stream *s, void *userdata)
 static void stream_underflow_cb(pa_stream *s, void *userdata)
 {
     audio_output_t *aout = userdata;
+    aout_sys_t *sys = aout->sys;
 
     msg_Dbg(aout, "underflow");
-    (void) s;
+
+    sys->first_pts = VLC_TS_INVALID;
+    pa_stream_set_latency_update_callback(s, NULL, NULL);
+    stream_stop(s, aout);
 }
 
 static int stream_wait(pa_stream *stream, pa_threaded_mainloop *mainloop)
-- 
2.1.3

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
<a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a>

</pre></body></html>