mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
gnloperation: Totally clear operations when removing emptying current_bin
Removing linked childre leads to weird behaviour, we want to make sure that all elements are totally clean when they are out the current bin. Co-Authored by: Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
This commit is contained in:
parent
837ef2199f
commit
96672825d5
5 changed files with 50 additions and 1 deletions
|
@ -1073,6 +1073,10 @@ _remove_child (GValue * item, GValue * ret G_GNUC_UNUSED, GstBin * bin)
|
|||
{
|
||||
GstElement *child = g_value_get_object (item);
|
||||
|
||||
if (GNL_IS_OPERATION (child))
|
||||
gnl_operation_hard_cleanup (GNL_OPERATION (child));
|
||||
|
||||
|
||||
gst_bin_remove (bin, child);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -418,7 +418,7 @@ gnl_object_cleanup_func (GnlObject * object)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
GstStateChangeReturn
|
||||
gnl_object_cleanup (GnlObject * object)
|
||||
{
|
||||
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
||||
|
|
|
@ -166,5 +166,9 @@ gnl_object_commit (GnlObject *object, gboolean recurse);
|
|||
|
||||
void
|
||||
gnl_object_reset (GnlObject *object);
|
||||
|
||||
GstStateChangeReturn
|
||||
gnl_object_cleanup (GnlObject * object);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GNL_OBJECT_H__ */
|
||||
|
|
|
@ -728,6 +728,45 @@ gnl_operation_cleanup (GnlObject * object)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gnl_operation_hard_cleanup (GnlOperation * operation)
|
||||
{
|
||||
gboolean done = FALSE;
|
||||
|
||||
GValue item = { 0, };
|
||||
GstIterator *pads;
|
||||
|
||||
GST_INFO_OBJECT (operation, "Hard reset of the operation");
|
||||
|
||||
pads = gst_element_iterate_sink_pads (GST_ELEMENT (operation));
|
||||
while (!done) {
|
||||
switch (gst_iterator_next (pads, &item)) {
|
||||
case GST_ITERATOR_OK:
|
||||
{
|
||||
GstPad *sinkpad = g_value_get_object (&item);
|
||||
GstPad *srcpad = gst_pad_get_peer (sinkpad);
|
||||
|
||||
if (srcpad) {
|
||||
GST_ERROR ("Unlinking %" GST_PTR_FORMAT " and %"
|
||||
GST_PTR_FORMAT, srcpad, sinkpad);
|
||||
gst_pad_unlink (srcpad, sinkpad);
|
||||
}
|
||||
|
||||
g_value_reset (&item);
|
||||
break;
|
||||
}
|
||||
case GST_ITERATOR_RESYNC:
|
||||
gst_iterator_resync (pads);
|
||||
break;
|
||||
default:
|
||||
/* ERROR and DONE */
|
||||
done = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gnl_object_cleanup (GNL_OBJECT (operation));
|
||||
}
|
||||
|
||||
|
||||
static GstPad *
|
||||
gnl_operation_request_new_pad (GstElement * element, GstPadTemplate * templ,
|
||||
|
|
|
@ -80,6 +80,8 @@ gnl_operation_signal_input_priority_changed(GnlOperation * operation, GstPad *pa
|
|||
void gnl_operation_update_base_time (GnlOperation *operation,
|
||||
GstClockTime timestamp);
|
||||
|
||||
void gnl_operation_hard_cleanup (GnlOperation *operation);
|
||||
|
||||
|
||||
/* normal GOperation stuff */
|
||||
GType gnl_operation_get_type (void);
|
||||
|
|
Loading…
Reference in a new issue