summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Svensson Fors <davidsf@axis.com>2013-09-23 11:35:43 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-10-01 22:12:07 +0200
commit09d628f8f1a103a32b8c9d25581299f77480c4d5 (patch)
treeebe3a188ebb9120bef65bc2ed5ad99e5492ca5b7
parentf330c014121590a5fad01fd06aef1273812b3315 (diff)
audioringbuffer: check if acquired in set_timestamp
Also use GST_OBJECT_LOCK when accessing object data in set_timestamp. https://bugzilla.gnome.org/show_bug.cgi?id=702230
-rw-r--r--gst-libs/gst/audio/gstaudioringbuffer.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gst-libs/gst/audio/gstaudioringbuffer.c b/gst-libs/gst/audio/gstaudioringbuffer.c
index 049416187..0a883efdc 100644
--- a/gst-libs/gst/audio/gstaudioringbuffer.c
+++ b/gst-libs/gst/audio/gstaudioringbuffer.c
@@ -1984,9 +1984,20 @@ gst_audio_ring_buffer_set_timestamp (GstAudioRingBuffer * buf, gint readseg,
GST_INFO_OBJECT (buf, "Storing timestamp %" GST_TIME_FORMAT
" @ %d", GST_TIME_ARGS (timestamp), readseg);
- if (buf->timestamps) {
- buf->timestamps[readseg] = timestamp;
- } else {
- GST_ERROR_OBJECT (buf, "Could not store timestamp, no timestamps buffer");
+
+ GST_OBJECT_LOCK (buf);
+ if (G_UNLIKELY (!buf->acquired))
+ goto not_acquired;
+
+ buf->timestamps[readseg] = timestamp;
+
+done:
+ GST_OBJECT_UNLOCK (buf);
+ return;
+
+not_acquired:
+ {
+ GST_DEBUG_OBJECT (buf, "we are not acquired");
+ goto done;
}
}