summaryrefslogtreecommitdiffstats
path: root/Alc/backends
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends')
-rw-r--r--Alc/backends/pulseaudio.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c
index f727b639..ee7a633f 100644
--- a/Alc/backends/pulseaudio.c
+++ b/Alc/backends/pulseaudio.c
@@ -437,21 +437,11 @@ static void stream_signal_callback(pa_stream *stream, void *pdata) //{{{
static void stream_buffer_attr_callback(pa_stream *stream, void *pdata) //{{{
{
- ALCdevice *Device = pdata;
- pulse_data *data = Device->ExtraData;
-
- LockDevice(Device);
-
- data->attr = *(pa_stream_get_buffer_attr(stream));
- Device->UpdateSize = data->attr.minreq / data->frame_size;
- Device->NumUpdates = (data->attr.tlength/data->frame_size) / Device->UpdateSize;
- if(Device->NumUpdates <= 1)
- {
- Device->NumUpdates = 1;
- ERR("PulseAudio returned minreq > tlength/2; expect lag or break up\n");
- }
+ const pa_buffer_attr *attr;
+ (void)pdata;
- UnlockDevice(Device);
+ attr = pa_stream_get_buffer_attr(stream);
+ WARN("PulseAudio modified buffer length: minreq=%d, tlength=%d\n", attr->minreq, attr->tlength);
}//}}}
static void stream_device_callback(pa_stream *stream, void *pdata) //{{{
@@ -1018,11 +1008,23 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
device->Frequency = data->spec.rate;
}
- stream_buffer_attr_callback(data->stream, device);
- if(device->NumUpdates < 2)
+#if PA_CHECK_VERSION(0,9,15)
+ if(pa_stream_set_buffer_attr_callback)
+ pa_stream_set_buffer_attr_callback(data->stream, stream_buffer_attr_callback, device);
+#endif
+ pa_stream_set_moved_callback(data->stream, stream_device_callback, device);
+ pa_stream_set_write_callback(data->stream, stream_write_callback, device);
+ pa_stream_set_underflow_callback(data->stream, stream_signal_callback, device);
+
+ data->attr = *(pa_stream_get_buffer_attr(data->stream));
+ device->UpdateSize = data->attr.minreq / data->frame_size;
+ device->NumUpdates = (data->attr.tlength/data->frame_size) / device->UpdateSize;
+ if(device->NumUpdates <= 1)
{
pa_operation *o;
+ ERR("PulseAudio returned minreq=%d, tlength=%d; expect lag or break up\n", data->attr.minreq, data->attr.tlength);
+
/* Server gave a comparatively large minreq, so modify the tlength. */
device->NumUpdates = 2;
data->attr.tlength = data->attr.minreq * device->NumUpdates;
@@ -1034,14 +1036,6 @@ static ALCboolean pulse_reset_playback(ALCdevice *device) //{{{
pa_operation_unref(o);
}
-#if PA_CHECK_VERSION(0,9,15)
- if(pa_stream_set_buffer_attr_callback)
- pa_stream_set_buffer_attr_callback(data->stream, stream_buffer_attr_callback, device);
-#endif
- pa_stream_set_moved_callback(data->stream, stream_device_callback, device);
- pa_stream_set_write_callback(data->stream, stream_write_callback, device);
- pa_stream_set_underflow_callback(data->stream, stream_signal_callback, device);
-
data->thread = StartThread(PulseProc, device);
if(!data->thread)
{