X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faudio_output%2Fpulse.c;h=f36ec0949e6233c87e43b29ca842b05005535873;hb=36c1cbc3f2e228ef120e7413cc2613d3f8aded5c;hp=a2ccfbc2a150a82da4f4daf2ec1bd61ef57d4bbb;hpb=94d22180c0afcd6f4f7cf45c9e23b091f728f4eb;p=vlc diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c index a2ccfbc2a1..f36ec0949e 100644 --- a/modules/audio_output/pulse.c +++ b/modules/audio_output/pulse.c @@ -34,6 +34,9 @@ #include #include +#ifdef HAVE_X11_XLIB_H +# include +#endif #include @@ -96,7 +99,7 @@ static void uninit(aout_instance_t *p_aout); * Module descriptor *****************************************************************************/ vlc_module_begin () - set_shortname( "Pulse Audio" ) + set_shortname( "PulseAudio" ) set_description( N_("Pulseaudio audio output") ) set_capability( "audio output", 160 ) set_category( CAT_AUDIO ) @@ -104,7 +107,6 @@ vlc_module_begin () add_shortcut( "pulseaudio" ) add_shortcut( "pa" ) set_callbacks( Open, Close ) - linked_with_a_crap_library_which_uses_atexit() vlc_module_end () /***************************************************************************** @@ -119,6 +121,12 @@ static int Open ( vlc_object_t *p_this ) struct pa_buffer_attr a; struct pa_channel_map map; +#ifdef X_DISPLAY_MISSING +# error Xlib required due to PulseAudio bug 799! +#else + if( !XInitThreads() ) + return VLC_EGENERIC; +#endif /* Allocate structures */ p_aout->output.p_sys = p_sys = calloc( 1, sizeof( aout_sys_t ) ); if( p_sys == NULL ) @@ -338,11 +346,16 @@ static void Close ( vlc_object_t *p_this ) msg_Dbg(p_aout, "Pulse Close"); if(p_sys->stream){ - pa_operation *o; pa_threaded_mainloop_lock(p_sys->mainloop); pa_stream_set_write_callback(p_sys->stream, NULL, NULL); - if((o = pa_stream_drain(p_sys->stream, success_cb, p_aout))){ +/* 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); @@ -352,7 +365,7 @@ static void Close ( vlc_object_t *p_this ) pa_operation_unref(o); } - +#endif pa_threaded_mainloop_unlock(p_sys->mainloop); } uninit(p_aout);