From a806b401352b34a832937dea7398811ce6458135 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 31 Oct 2014 11:01:47 +0100 Subject: [PATCH] videoaggregator: Let a full renegotiation happen after removing the last pad With the current code, we will end up setting the preferred downstream format as the srcpad format, and it might not be accepted by the next sinkpad to be added. We should instead let the next sinkpad reconfigure everything. --- gst-libs/gst/video/gstvideoaggregator.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c index 3dfa1b68a6..6a0fa558b3 100644 --- a/gst-libs/gst/video/gstvideoaggregator.c +++ b/gst-libs/gst/video/gstvideoaggregator.c @@ -1609,13 +1609,22 @@ gst_videoaggregator_release_pad (GstElement * element, GstPad * pad) { GstVideoAggregator *vagg = NULL; GstVideoAggregatorPad *vaggpad; - gboolean update_caps; + gboolean update_caps, last_pad; vagg = GST_VIDEO_AGGREGATOR (element); vaggpad = GST_VIDEO_AGGREGATOR_PAD (pad); GST_VIDEO_AGGREGATOR_LOCK (vagg); - gst_videoaggregator_update_converters (vagg); + + GST_OBJECT_LOCK (vagg); + last_pad = (GST_ELEMENT (vagg)->numsinkpads - 1 == 0); + GST_OBJECT_UNLOCK (vagg); + + if (!last_pad) + gst_videoaggregator_update_converters (vagg); + else + gst_videoaggregator_reset (vagg); + gst_buffer_replace (&vaggpad->buffer, NULL); update_caps = GST_VIDEO_INFO_FORMAT (&vagg->info) != GST_VIDEO_FORMAT_UNKNOWN;