aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-07-30 20:20:40 -0700
committerChris Robinson <[email protected]>2010-07-30 20:20:40 -0700
commitd886fb118b7eac1c60597f6c915b5a3495c512b0 (patch)
tree81418866339d0353306a061513d46ce9752eb06d
parent46d46c49a87b33ed727a7099aca3dc89e06e57cd (diff)
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
-rw-r--r--Alc/pulseaudio.c14
1 files changed, 14 insertions, 0 deletions
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;