[vlc-devel] [RFC PATCH] PulseAudio: fix audio drop after an underflow

Thomas Guillem thomas at gllm.fr
Sat Apr 18 01:19:11 CEST 2015


On Fri, Apr 17, 2015, at 21:03, Rémi Denis-Courmont wrote:
> It was already pointed out a few weeks ago that this approach is
> wrong, because underflow can occur during normal playback.

OK. I proposed a new patch that stop the stream after a flush.

>
> --
> Rémi Denis-Courmont Sent from my NVIDIA Tegra-powered device
>
> ----- Reply message ----- De : "Thomas Guillem" <thomas at gllm.fr> Pour
> : <vlc-devel at videolan.org> Objet : [vlc-devel] [RFC PATCH] PulseAudio:
> fix audio drop after an underflow Date : ven., avr. 17, 2015 16:29
>
> 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:
> https://mailman.videolan.org/listinfo/vlc-devel
> _________________________________________________
> vlc-devel mailing list To unsubscribe or modify your subscription
> options: https://mailman.videolan.org/listinfo/vlc-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150418/b75e6b2a/attachment.html>


More information about the vlc-devel mailing list