summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-06-05 00:09:45 -0700
committerChris Robinson <[email protected]>2010-06-05 00:09:45 -0700
commit33234d605aca6c7f9a153e428191db146a5177b9 (patch)
tree281e83c0b8890eb31525417dfc4ff2573f569627 /Alc
parentc6defe9a6d574c14cb59f62ee1368f6d5b888a6a (diff)
Don't attempt to look for more samples from Pulse after a disconnect
Diffstat (limited to 'Alc')
-rw-r--r--Alc/pulseaudio.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index f72df3a2..e4c6f2fc 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -1081,12 +1081,11 @@ static ALCuint pulse_available_samples(ALCdevice *device) //{{{
{
pulse_data *data = device->ExtraData;
size_t samples;
- ALCuint ret;
ppa_threaded_mainloop_lock(data->loop);
/* Capture is done in fragment-sized chunks, so we loop until we get all
* that's available */
- samples = ppa_stream_readable_size(data->stream);
+ samples = (device->Connected ? ppa_stream_readable_size(data->stream) : 0);
while(samples > 0)
{
const void *buf;
@@ -1104,22 +1103,19 @@ static ALCuint pulse_available_samples(ALCdevice *device) //{{{
ppa_stream_drop(data->stream);
}
- ret = RingBufferSize(data->ring);
ppa_threaded_mainloop_unlock(data->loop);
- return ret;
+ return RingBufferSize(data->ring);
} //}}}
static void pulse_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) //{{{
{
pulse_data *data = device->ExtraData;
- ppa_threaded_mainloop_lock(data->loop);
if(pulse_available_samples(device) >= samples)
ReadRingBuffer(data->ring, buffer, samples);
else
alcSetError(device, ALC_INVALID_VALUE);
- ppa_threaded_mainloop_unlock(data->loop);
} //}}}
BackendFuncs pulse_funcs = { //{{{