diff options
author | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-03-16 18:52:24 +0000 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2011-03-16 18:53:27 +0000 |
commit | 1634a9f2628be6e011131b4319057cbaa0a560d1 (patch) | |
tree | 6f63bb0ec102ea025ce481652c426785c837e4c2 /sys | |
parent | ca9d60702f11c00f6e04bf47a024279e91aa4729 (diff) | |
download | gstreamer-plugins-bad-1634a9f2628be6e011131b4319057cbaa0a560d1.tar.gz |
shmsink: Keep shmsink referenced while there are still buffers around
Diffstat (limited to 'sys')
-rw-r--r-- | sys/shm/gstshmsink.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/shm/gstshmsink.c b/sys/shm/gstshmsink.c index 0cec9eac2..1f7d1cb21 100644 --- a/sys/shm/gstshmsink.c +++ b/sys/shm/gstshmsink.c @@ -298,6 +298,7 @@ gst_shm_sink_start (GstBaseSink * bsink) return FALSE; } + sp_set_data (self->pipe, self); g_free (self->socket_path); self->socket_path = g_strdup (sp_writer_get_path (self->pipe)); @@ -411,8 +412,17 @@ gst_shm_sink_render (GstBaseSink * bsink, GstBuffer * buf) static void gst_shm_sink_free_buffer (gpointer data) { + ShmPipe *pipe; ShmBlock *block = data; + GstShmSink *self; + + pipe = sp_writer_block_get_pipe (block); + self = sp_get_data (pipe); + + GST_OBJECT_LOCK (self); sp_writer_free_block (block); + GST_OBJECT_UNLOCK (self); + g_object_unref (self); } static GstFlowReturn @@ -426,8 +436,10 @@ gst_shm_sink_buffer_alloc (GstBaseSink * sink, guint64 offset, guint size, GST_OBJECT_LOCK (self); block = sp_writer_alloc_block (self->pipe, size); - if (block) + if (block) { buf = sp_writer_block_get_buf (block); + g_object_ref (self); + } GST_OBJECT_UNLOCK (self); if (block) { |