[vlc-commits] commit: Pulse: do flush in close() not play() (Ilkka Ollakka )
git at videolan.org
git at videolan.org
Mon Jul 5 20:06:25 CEST 2010
vlc/vlc-1.1 | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Mon Jul 5 12:49:05 2010 +0300| [2eefdc24db10837d81458db067af2911d78defa0] | committer: Ilkka Ollakka
Pulse: do flush in close() not play()
Also compare against RUNNING and not DONE on waiting loop. Also lock mainloop
when modifying values that are used in callback-code, and don't signal without lock.
(cherry picked from commit f16cd68a2a2333296cd337f69180fba3b6958226)
Signed-off-by: Ilkka Ollakka <ileoo at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=2eefdc24db10837d81458db067af2911d78defa0
---
modules/audio_output/pulse.c | 35 ++++++++++++-----------------------
1 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index e7c7450..86efc21 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -315,21 +315,15 @@ static void Play( aout_instance_t * p_aout )
{
struct aout_sys_t * p_sys = (struct aout_sys_t *) p_aout->output.p_sys;
- pa_operation *o;
-
if(!p_sys->started){
msg_Dbg(p_aout, "Pulse stream started");
+ pa_threaded_mainloop_lock(p_sys->mainloop);
p_sys->start_date =
aout_FifoFirstDate( p_aout, &p_aout->output.fifo );
p_sys->started = 1;
- pa_threaded_mainloop_lock(p_sys->mainloop);
- if((o = pa_stream_flush(p_sys->stream, success_cb, p_aout))){
- pa_operation_unref(o);
- }
- pa_threaded_mainloop_unlock(p_sys->mainloop);
-
pa_threaded_mainloop_signal(p_sys->mainloop, 0);
+ pa_threaded_mainloop_unlock(p_sys->mainloop);
}
}
@@ -347,23 +341,18 @@ static void Close ( vlc_object_t *p_this )
pa_threaded_mainloop_lock(p_sys->mainloop);
pa_stream_set_write_callback(p_sys->stream, NULL, NULL);
-/* I didn't find any explanation why we need to do pa_stream_drain on close
- * as we don't really care if we lose 20ms buffer in this point anyway?
- * And disabling this speeds up closing pulseaudio quite a lot (atleast for me).
- */
-#if 0
- pa_operation *o = pa_stream_drain(p_sys->stream, success_cb, p_aout);
- if(o){
- while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
- CHECK_DEAD_GOTO(fail);
- pa_threaded_mainloop_wait(p_sys->mainloop);
- }
+ pa_operation *o;
- fail:
+ o = pa_stream_flush(p_sys->stream, success_cb, p_aout);
+ while( pa_operation_get_state(o) == PA_OPERATION_RUNNING )
+ pa_threaded_mainloop_wait(p_sys->mainloop);
+ pa_operation_unref(o);
+
+ o = pa_stream_drain(p_sys->stream, success_cb, p_aout);
+ while( pa_operation_get_state(o) == PA_OPERATION_RUNNING )
+ pa_threaded_mainloop_wait(p_sys->mainloop);
+ pa_operation_unref(o);
- pa_operation_unref(o);
- }
-#endif
pa_threaded_mainloop_unlock(p_sys->mainloop);
}
uninit(p_aout);
More information about the vlc-commits
mailing list