From f816903e653cd4987d697cf7153097e19970d8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicia=20Boya=20Garc=C3=ADa?= Date: Mon, 9 Dec 2019 17:54:02 +0100 Subject: [PATCH] gsttestsrcbin: Avoid not-linked errors when switching tracks The previous implementation had a very high reproducibility race where if after a track switch, the ex-active track pad completed a buffer chain (now returning not-linked) the flow combiner had all their pads in non-linked state, propagating it as an error and stopping the pipeline. By resetting the flow combiner in response to RECONFIGURE events that race is made impossible. --- gst/debugutils/gsttestsrcbin.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gst/debugutils/gsttestsrcbin.c b/gst/debugutils/gsttestsrcbin.c index f5901f8f71..89e18e8497 100644 --- a/gst/debugutils/gsttestsrcbin.c +++ b/gst/debugutils/gsttestsrcbin.c @@ -176,12 +176,18 @@ gst_test_src_bin_chain (GstPad * pad, GstObject * object, GstBuffer * buffer) GstTestSrcBin *self = GST_TEST_SRC_BIN (gst_object_get_parent (object)); chain_res = gst_proxy_pad_chain_default (pad, GST_OBJECT (self), buffer); + GST_OBJECT_LOCK (self); res = gst_flow_combiner_update_pad_flow (self->flow_combiner, pad, chain_res); + GST_OBJECT_UNLOCK (self); gst_object_unref (self); if (res == GST_FLOW_FLUSHING) return chain_res; + if (res == GST_FLOW_NOT_LINKED) + GST_WARNING_OBJECT (pad, + "all testsrcbin pads not linked, returning not-linked."); + return res; } @@ -219,6 +225,13 @@ static gboolean gst_test_src_event_function (GstPad * pad, GstObject * parent, GstEvent * event) { switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_RECONFIGURE:{ + GstTestSrcBin *self = GST_TEST_SRC_BIN (parent); + GST_OBJECT_LOCK (self); + gst_flow_combiner_reset (self->flow_combiner); + GST_OBJECT_UNLOCK (self); + break; + } case GST_EVENT_SEEK:{ ForwardEventData data = { event, TRUE, parent };