diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-04-10 14:18:48 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-04-10 14:18:48 +0200 |
commit | 963b343548b0da29dc7f4f28db76b74c431d53fc (patch) | |
tree | d4a06118f13957545dec1d9c9ee1a490434fd9c4 /ext/pulse/pulsesink.c | |
parent | 20a6908dfde4a5a76a61f620533bbb82e9a5b7e8 (diff) |
pulsesink: handle server disconnect in get_time
When the server is disconnected or when we are shut down, make our clock return
an invalid time instead of erroring out.
Diffstat (limited to 'ext/pulse/pulsesink.c')
-rw-r--r-- | ext/pulse/pulsesink.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index e2bc57da..48bd7f2f 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -1338,6 +1338,8 @@ gst_pulse_sink_get_time (GstClock * clock, GstBaseAudioSink * sink) psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf)); pa_threaded_mainloop_lock (psink->mainloop); + if (gst_pulsering_is_dead (psink, pbuf)) + goto server_dead; /* if we don't have enough data to get a timestamp, just return NONE, which * will return the last reported time */ @@ -1352,6 +1354,15 @@ gst_pulse_sink_get_time (GstClock * clock, GstBaseAudioSink * sink) GST_TIME_ARGS (time)); return time; + + /* ERRORS */ +server_dead: + { + GST_DEBUG_OBJECT (psink, "the server is dead"); + pa_threaded_mainloop_unlock (psink->mainloop); + + return GST_CLOCK_TIME_NONE; + } } static void |