summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2017-09-05 15:57:51 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-09-05 16:00:09 -0400
commit1cd0dd3503c141954ba0740cc5eca6676af9c028 (patch)
treed4a92f0a80e302a656ce836ff2cfbade49d5b62c /plugins
parent291400d819ee823f4b02ad0f56cc74ae0b9e38f7 (diff)
tee: Allocate one more buffer when multi-plexing
This extra buffer ensure that the downstream threads are not starved when multiplexing a stream. https://bugzilla.gnome.org/show_bug.cgi?id=730758
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elements/gsttee.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c
index ce5449a34..bc38b6b4b 100644
--- a/plugins/elements/gsttee.c
+++ b/plugins/elements/gsttee.c
@@ -573,6 +573,7 @@ struct AllocQueryCtx
guint size;
guint min_buffers;
gboolean first_query;
+ guint num_pads;
};
/* This function will aggregate some of the allocation query information with
@@ -715,6 +716,7 @@ gst_tee_query_allocation (const GValue * item, GValue * ret, gpointer user_data)
}
ctx->first_query = FALSE;
+ ctx->num_pads++;
gst_query_unref (query);
return TRUE;
@@ -758,6 +760,7 @@ gst_tee_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
gst_allocation_params_init (&ctx.params);
ctx.size = 0;
ctx.min_buffers = 0;
+ ctx.num_pads = 0;
gst_tee_clear_query_allocation_meta (query);
}
@@ -789,6 +792,11 @@ gst_tee_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
}
#endif
+ /* Allocate one more buffers when multiplexing so we don't starve the
+ * downstream threads. */
+ if (ctx.num_pads > 1)
+ ctx.min_buffers++;
+
gst_query_add_allocation_param (ctx.query, NULL, &ctx.params);
gst_query_add_allocation_pool (ctx.query, NULL, ctx.size,
ctx.min_buffers, 0);