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
This commit is contained in:
Chris Robinson 2010-07-30 20:20:40 -07:00
parent 46d46c49a8
commit d886fb118b

View File

@ -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;