aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-07-26 22:04:26 -0700
committerChris Robinson <[email protected]>2014-07-26 22:04:26 -0700
commit6864053eee2393e203b2155681ab585a713af48a (patch)
tree5cbb05d167aef31f4b111c7d5ee18d743a8dca37 /Alc/backends
parent0ad3f61351e85882fb6f119c05152136098a3233 (diff)
Use pulseaudio's write callback to signal a mixer proc wakeup
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/pulseaudio.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index b392f18e..90166127 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -435,7 +435,9 @@ static void pulse_close(pa_threaded_mainloop *loop, pa_context *context,
if(stream)
{
+ pa_stream_set_state_callback(stream, NULL, NULL);
pa_stream_set_moved_callback(stream, NULL, NULL);
+ pa_stream_set_write_callback(stream, NULL, NULL);
#if PA_CHECK_VERSION(0,9,15)
if(pa_stream_set_buffer_attr_callback)
pa_stream_set_buffer_attr_callback(stream, NULL, NULL);
@@ -501,6 +503,7 @@ static void ALCpulsePlayback_probeDevices(void);
static void ALCpulsePlayback_bufferAttrCallback(pa_stream *stream, void *pdata);
static void ALCpulsePlayback_contextStateCallback(pa_context *context, void *pdata);
static void ALCpulsePlayback_streamStateCallback(pa_stream *stream, void *pdata);
+static void ALCpulsePlayback_streamWriteCallback(pa_stream *p, size_t nbytes, void *userdata);
static void ALCpulsePlayback_sinkInfoCallback(pa_context *context, const pa_sink_info *info, int eol, void *pdata);
static void ALCpulsePlayback_sinkNameCallback(pa_context *context, const pa_sink_info *info, int eol, void *pdata);
static void ALCpulsePlayback_streamMovedCallback(pa_stream *stream, void *pdata);
@@ -657,6 +660,12 @@ static void ALCpulsePlayback_streamStateCallback(pa_stream *stream, void *pdata)
pa_threaded_mainloop_signal(self->loop, 0);
}
+static void ALCpulsePlayback_streamWriteCallback(pa_stream* UNUSED(p), size_t UNUSED(nbytes), void *pdata)
+{
+ ALCpulsePlayback *self = pdata;
+ pa_threaded_mainloop_signal(self->loop, 0);
+}
+
static void ALCpulsePlayback_sinkInfoCallback(pa_context *UNUSED(context), const pa_sink_info *info, int eol, void *pdata)
{
ALCpulsePlayback *self = pdata;
@@ -806,9 +815,7 @@ static int ALCpulsePlayback_mixerProc(void *ptr)
o = pa_stream_cork(self->stream, 0, NULL, NULL);
if(o) pa_operation_unref(o);
}
- pa_threaded_mainloop_unlock(self->loop);
- al_nssleep(0, 1000000);
- pa_threaded_mainloop_lock(self->loop);
+ pa_threaded_mainloop_wait(self->loop);
continue;
}
len -= len%update_size;
@@ -1037,6 +1044,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self)
}
pa_stream_set_state_callback(self->stream, ALCpulsePlayback_streamStateCallback, self);
pa_stream_set_moved_callback(self->stream, ALCpulsePlayback_streamMovedCallback, self);
+ pa_stream_set_write_callback(self->stream, ALCpulsePlayback_streamWriteCallback, self);
self->spec = *(pa_stream_get_sample_spec(self->stream));
if(device->Frequency != self->spec.rate)