diff options
author | Michael Tretter <m.tretter@pengutronix.de> | 2020-05-05 13:07:12 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2020-05-05 13:53:02 +0000 |
commit | 52c14e2378f8dd9fd067f31900b1390220da940b (patch) | |
tree | af8e162013cdc7633e2fcb94d757ea195472c052 /src | |
parent | 8adc4ad3b662e099f2a154709b91786c74cb22cb (diff) |
gst: keep track of queued buffers
Pipewire might update buffers that have not been recycled by GStreamer,
because they are still used downstream. There is nothing we can do about
it in the pipewiresrc.
If a buffer is sent downstream more than once, take an additional
reference to make sure that we don't queue a buffer that is still used
and print a warning.
Diffstat (limited to 'src')
-rw-r--r-- | src/gst/gstpipewirepool.h | 1 | ||||
-rw-r--r-- | src/gst/gstpipewiresrc.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/gst/gstpipewirepool.h b/src/gst/gstpipewirepool.h index bdb272ab..eb3d8d16 100644 --- a/src/gst/gstpipewirepool.h +++ b/src/gst/gstpipewirepool.h @@ -56,6 +56,7 @@ struct _GstPipeWirePoolData { goffset offset; struct pw_buffer *b; GstBuffer *buf; + gboolean queued; }; struct _GstPipeWirePool { diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 13f14d45..74cb7b36 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -373,6 +373,7 @@ buffer_recycle (GstMiniObject *obj) GST_BUFFER_FLAGS (obj) = data->flags; src = data->owner; + data->queued = TRUE; GST_LOG_OBJECT (obj, "recycle buffer"); pw_thread_loop_lock (src->loop); @@ -392,6 +393,7 @@ on_add_buffer (void *_data, struct pw_buffer *b) gst_pipewire_pool_wrap_buffer (pwsrc->pool, b); data = b->user_data; data->owner = pwsrc; + data->queued = TRUE; GST_MINI_OBJECT_CAST (data->buf)->dispose = buffer_recycle; } @@ -426,6 +428,11 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc) GST_LOG_OBJECT (pwsrc, "got new buffer %p", buf); + if (!data->queued) { + GST_WARNING_OBJECT (pwsrc, "buffer %p was not recycled", buf); + gst_buffer_ref (buf); + } + data->queued = FALSE; GST_BUFFER_PTS (buf) = GST_CLOCK_TIME_NONE; GST_BUFFER_DTS (buf) = GST_CLOCK_TIME_NONE; |