From d886fb118b7eac1c60597f6c915b5a3495c512b0 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 30 Jul 2010 20:20:40 -0700 Subject: Signal the Pulse mainloop on underruns Otherwise there are (rare) risks of not getting signaled after writing the amount of free audio data the client knows about, leading to a mixer loop lockup --- Alc/pulseaudio.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Alc/pulseaudio.c') diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c index 9355cc36..92dfc417 100644 --- a/Alc/pulseaudio.c +++ b/Alc/pulseaudio.c @@ -96,6 +96,7 @@ MAKE_FUNC(pa_stream_get_sample_spec); MAKE_FUNC(pa_stream_set_read_callback); MAKE_FUNC(pa_stream_set_state_callback); MAKE_FUNC(pa_stream_set_moved_callback); +MAKE_FUNC(pa_stream_set_underflow_callback); MAKE_FUNC(pa_stream_new); MAKE_FUNC(pa_stream_disconnect); MAKE_FUNC(pa_threaded_mainloop_lock); @@ -253,6 +254,7 @@ LOAD_FUNC(pa_stream_get_sample_spec); LOAD_FUNC(pa_stream_set_read_callback); LOAD_FUNC(pa_stream_set_state_callback); LOAD_FUNC(pa_stream_set_moved_callback); +LOAD_FUNC(pa_stream_set_underflow_callback); LOAD_FUNC(pa_stream_new); LOAD_FUNC(pa_stream_disconnect); LOAD_FUNC(pa_threaded_mainloop_lock); @@ -301,6 +303,15 @@ static void stream_state_callback(pa_stream *stream, void *pdata) //{{{ ppa_threaded_mainloop_signal(loop, 0); }//}}} +static void stream_signal_callback(pa_stream *stream, void *pdata) //{{{ +{ + ALCdevice *Device = pdata; + pulse_data *data = Device->ExtraData; + (void)stream; + + ppa_threaded_mainloop_signal(data->loop, 0); +}//}}} + static void stream_buffer_attr_callback(pa_stream *stream, void *pdata) //{{{ { ALCdevice *Device = pdata; @@ -937,6 +948,7 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{ #endif ppa_stream_set_moved_callback(data->stream, stream_device_callback, device); ppa_stream_set_write_callback(data->stream, stream_write_callback, device); + ppa_stream_set_underflow_callback(data->stream, stream_signal_callback, device); device->TimeRes = (ALuint64)device->UpdateSize * 1000000000 / device->Frequency; @@ -950,6 +962,7 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{ #endif ppa_stream_set_moved_callback(data->stream, NULL, NULL); ppa_stream_set_write_callback(data->stream, NULL, NULL); + ppa_stream_set_underflow_callback(data->stream, NULL, NULL); ppa_stream_disconnect(data->stream); ppa_stream_unref(data->stream); data->stream = NULL; @@ -986,6 +999,7 @@ static void pulse_stop_playback(ALCdevice *device) //{{{ #endif ppa_stream_set_moved_callback(data->stream, NULL, NULL); ppa_stream_set_write_callback(data->stream, NULL, NULL); + ppa_stream_set_underflow_callback(data->stream, NULL, NULL); ppa_stream_disconnect(data->stream); ppa_stream_unref(data->stream); data->stream = NULL; -- cgit v1.2.3