aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/pulseaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/pulseaudio.c')
-rw-r--r--Alc/pulseaudio.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Alc/pulseaudio.c b/Alc/pulseaudio.c
index b5e6f4ab..44ae427a 100644
--- a/Alc/pulseaudio.c
+++ b/Alc/pulseaudio.c
@@ -138,6 +138,7 @@ typedef struct {
pa_threaded_mainloop *loop;
ALuint64 baseTime;
+ pa_usec_t lastTime;
ALvoid *thread;
volatile ALboolean killNow;
@@ -1004,8 +1005,10 @@ static void pulse_stop_playback(ALCdevice *device) //{{{
ppa_threaded_mainloop_lock(data->loop);
- if(ppa_stream_get_time(data->stream, &usec) != PA_ERR_NODATA)
- data->baseTime += usec*1000;
+ if(ppa_stream_get_time(data->stream, &usec) != PA_OK)
+ usec = data->lastTime;
+ data->baseTime += usec*1000;
+ data->lastTime = 0;
#if PA_CHECK_VERSION(0,9,15)
if(ppa_stream_set_buffer_attr_callback)
@@ -1241,8 +1244,10 @@ static ALuint64 pulse_get_time(ALCdevice *Device) //{{{
pa_usec_t usec;
ppa_threaded_mainloop_lock(data->loop);
- if(!data->stream || ppa_stream_get_time(data->stream, &usec) == PA_ERR_NODATA)
- usec = 0;
+ if(!data->stream || ppa_stream_get_time(data->stream, &usec) != PA_OK)
+ usec = data->lastTime;
+ else
+ data->lastTime = usec;
ppa_threaded_mainloop_unlock(data->loop);
return data->baseTime + usec*1000;