bin: Also don't *unset* element flags if they're in the suppressed flags

Otherwise our bin might lose various flags that were explicitly set on
it at arbitrary times.
This commit is contained in:
Sebastian Dröge 2016-09-12 17:07:09 +02:00
parent 29c3b8b4d5
commit c7e0299d24

View file

@ -1665,22 +1665,26 @@ gst_bin_remove_func (GstBin * bin, GstElement * element)
if (!GST_BIN_IS_NO_RESYNC (bin)) if (!GST_BIN_IS_NO_RESYNC (bin))
bin->priv->structure_cookie++; bin->priv->structure_cookie++;
if (is_sink && !othersink) { if (is_sink && !othersink
&& !(bin->priv->suppressed_flags & GST_ELEMENT_FLAG_SINK)) {
/* we're not a sink anymore */ /* we're not a sink anymore */
GST_DEBUG_OBJECT (bin, "we removed the last sink"); GST_DEBUG_OBJECT (bin, "we removed the last sink");
GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_SINK); GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_SINK);
} }
if (is_source && !othersource) { if (is_source && !othersource
&& !(bin->priv->suppressed_flags & GST_ELEMENT_FLAG_SOURCE)) {
/* we're not a source anymore */ /* we're not a source anymore */
GST_DEBUG_OBJECT (bin, "we removed the last source"); GST_DEBUG_OBJECT (bin, "we removed the last source");
GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_SOURCE); GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_SOURCE);
} }
if (provides_clock && !otherprovider) { if (provides_clock && !otherprovider
&& !(bin->priv->suppressed_flags & GST_ELEMENT_FLAG_PROVIDE_CLOCK)) {
/* we're not a clock provider anymore */ /* we're not a clock provider anymore */
GST_DEBUG_OBJECT (bin, "we removed the last clock provider"); GST_DEBUG_OBJECT (bin, "we removed the last clock provider");
GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_PROVIDE_CLOCK); GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
} }
if (requires_clock && !otherrequirer) { if (requires_clock && !otherrequirer
&& !(bin->priv->suppressed_flags & GST_ELEMENT_FLAG_REQUIRE_CLOCK)) {
/* we're not a clock requirer anymore */ /* we're not a clock requirer anymore */
GST_DEBUG_OBJECT (bin, "we removed the last clock requirer"); GST_DEBUG_OBJECT (bin, "we removed the last clock requirer");
GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_REQUIRE_CLOCK); GST_OBJECT_FLAG_UNSET (bin, GST_ELEMENT_FLAG_REQUIRE_CLOCK);