mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
composition: Make sure we have a peer when we send flushes downstream
And avoid leaks Co-Authored by: Thibault Saunier <tsaunier@gnome.org>
This commit is contained in:
parent
c81ee05c41
commit
08da7d6d2e
1 changed files with 15 additions and 11 deletions
|
@ -1815,7 +1815,6 @@ _set_current_bin_to_ready (GnlComposition * comp, gboolean flush_downstream)
|
||||||
|
|
||||||
if (flush_downstream) {
|
if (flush_downstream) {
|
||||||
ptarget = gst_ghost_pad_get_target (GST_GHOST_PAD (GNL_OBJECT_SRC (comp)));
|
ptarget = gst_ghost_pad_get_target (GST_GHOST_PAD (GNL_OBJECT_SRC (comp)));
|
||||||
|
|
||||||
if (ptarget) {
|
if (ptarget) {
|
||||||
GstEvent *flush_event;
|
GstEvent *flush_event;
|
||||||
GstPad *peer = gst_pad_get_peer (GNL_OBJECT_SRC (comp));
|
GstPad *peer = gst_pad_get_peer (GNL_OBJECT_SRC (comp));
|
||||||
|
@ -1830,25 +1829,30 @@ _set_current_bin_to_ready (GnlComposition * comp, gboolean flush_downstream)
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (comp, "added event probe %lu", priv->ghosteventprobe);
|
GST_DEBUG_OBJECT (comp, "added event probe %lu", priv->ghosteventprobe);
|
||||||
|
|
||||||
flush_event = gst_event_new_flush_start ();
|
if (peer) {
|
||||||
priv->flush_seqnum = gst_event_get_seqnum (flush_event);
|
flush_event = gst_event_new_flush_start ();
|
||||||
GST_ERROR_OBJECT (comp, "sending flushes downstream with seqnum %d",
|
priv->flush_seqnum = gst_event_get_seqnum (flush_event);
|
||||||
priv->flush_seqnum);
|
GST_INFO_OBJECT (comp, "sending flushes downstream with seqnum %d",
|
||||||
gst_pad_send_event (peer, flush_event);
|
priv->flush_seqnum);
|
||||||
|
gst_pad_send_event (peer, flush_event);
|
||||||
|
|
||||||
flush_event = gst_event_new_flush_stop (TRUE);
|
flush_event = gst_event_new_flush_stop (TRUE);
|
||||||
gst_event_set_seqnum (flush_event, priv->flush_seqnum);
|
gst_event_set_seqnum (flush_event, priv->flush_seqnum);
|
||||||
gst_pad_send_event (peer, flush_event);
|
gst_pad_send_event (peer, flush_event);
|
||||||
|
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_element_set_locked_state (priv->current_bin, TRUE);
|
gst_element_set_locked_state (priv->current_bin, TRUE);
|
||||||
gst_element_set_state (priv->current_bin, GST_STATE_READY);
|
gst_element_set_state (priv->current_bin, GST_STATE_READY);
|
||||||
|
|
||||||
if (ptarget)
|
if (ptarget) {
|
||||||
gst_pad_remove_probe (ptarget, probe_id);
|
gst_pad_remove_probe (ptarget, probe_id);
|
||||||
|
gst_object_unref (ptarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be called with OBJECTS_LOCK taken */
|
/* Must be called with OBJECTS_LOCK taken */
|
||||||
|
|
Loading…
Reference in a new issue