summaryrefslogtreecommitdiffstats
path: root/ext/pulse/pulsesink.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-04-10 21:31:06 +0200
committerWim Taymans <wim@metal.(none)>2009-04-10 21:32:54 +0200
commit776b0ae8cb588308e4a74c6a8b0cb80e151be23d (patch)
treecaceb7e8ae786c5bdb81bf8f84b61893c9fad7c5 /ext/pulse/pulsesink.c
parentb3d66d5e8df0287cdc684eb3bbcbb539b3a786c0 (diff)
pulsesink: handle NULL timing info
Don't crash when the timing info is not yet available.
Diffstat (limited to 'ext/pulse/pulsesink.c')
-rw-r--r--ext/pulse/pulsesink.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index 92b61884..8f8805f6 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -1092,17 +1092,21 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
/* check if we need to uncork after writing the samples */
if (pbuf->corked) {
- const pa_timing_info *info = pa_stream_get_timing_info (pbuf->stream);
-
- GST_LOG_OBJECT (psink,
- "read_index at %" G_GUINT64_FORMAT ", offset %" G_GINT64_FORMAT,
- info->read_index, offset);
-
- /* we uncork when the read_index is too far behind the offset we need
- * to write to. */
- if (info->read_index + bufsize <= offset) {
- if (!gst_pulsering_set_corked (pbuf, FALSE, FALSE))
- goto uncork_failed;
+ const pa_timing_info *info;
+
+ if ((info = pa_stream_get_timing_info (pbuf->stream))) {
+ GST_LOG_OBJECT (psink,
+ "read_index at %" G_GUINT64_FORMAT ", offset %" G_GINT64_FORMAT,
+ info->read_index, offset);
+
+ /* we uncork when the read_index is too far behind the offset we need
+ * to write to. */
+ if (info->read_index + bufsize <= offset) {
+ if (!gst_pulsering_set_corked (pbuf, FALSE, FALSE))
+ goto uncork_failed;
+ }
+ } else {
+ GST_LOG_OBJECT (psink, "no timing info available yet");
}
}
}