mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 04:05:34 +00:00
discoverer: Don't add pads/elements when cleaning up
There is no need to add more pads/elements since we are already done.
This commit is contained in:
parent
4636b8dd6f
commit
9c4b3b1ee7
1 changed files with 20 additions and 3 deletions
|
@ -89,6 +89,8 @@ struct _GstDiscovererPrivate
|
||||||
GList *pending_uris;
|
GList *pending_uris;
|
||||||
|
|
||||||
GMutex lock;
|
GMutex lock;
|
||||||
|
/* TRUE if cleaning up discoverer */
|
||||||
|
gboolean cleanup;
|
||||||
|
|
||||||
/* TRUE if processing a URI */
|
/* TRUE if processing a URI */
|
||||||
gboolean processing;
|
gboolean processing;
|
||||||
|
@ -614,6 +616,17 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dc, "pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_OBJECT (dc, "pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
|
DISCO_LOCK (dc);
|
||||||
|
if (dc->priv->cleanup) {
|
||||||
|
GST_WARNING_OBJECT (dc, "Cleanup, not adding pad");
|
||||||
|
DISCO_UNLOCK (dc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dc->priv->current_error) {
|
||||||
|
GST_WARNING_OBJECT (dc, "Ongoing error, not adding more pads");
|
||||||
|
DISCO_UNLOCK (dc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
ps = g_slice_new0 (PrivateStream);
|
ps = g_slice_new0 (PrivateStream);
|
||||||
|
|
||||||
ps->dc = dc;
|
ps->dc = dc;
|
||||||
|
@ -646,9 +659,7 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
|
||||||
gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
|
gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
|
||||||
(GstPadProbeCallback) got_subtitle_data, dc, NULL);
|
(GstPadProbeCallback) got_subtitle_data, dc, NULL);
|
||||||
g_object_set (ps->sink, "async", FALSE, NULL);
|
g_object_set (ps->sink, "async", FALSE, NULL);
|
||||||
DISCO_LOCK (dc);
|
|
||||||
dc->priv->pending_subtitle_pads++;
|
dc->priv->pending_subtitle_pads++;
|
||||||
DISCO_UNLOCK (dc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
@ -672,7 +683,6 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
|
||||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
||||||
(GstPadProbeCallback) _event_probe, ps, NULL);
|
(GstPadProbeCallback) _event_probe, ps, NULL);
|
||||||
|
|
||||||
DISCO_LOCK (dc);
|
|
||||||
dc->priv->streams = g_list_append (dc->priv->streams, ps);
|
dc->priv->streams = g_list_append (dc->priv->streams, ps);
|
||||||
DISCO_UNLOCK (dc);
|
DISCO_UNLOCK (dc);
|
||||||
|
|
||||||
|
@ -689,6 +699,7 @@ error:
|
||||||
if (ps->sink)
|
if (ps->sink)
|
||||||
gst_object_unref (ps->sink);
|
gst_object_unref (ps->sink);
|
||||||
g_slice_free (PrivateStream, ps);
|
g_slice_free (PrivateStream, ps);
|
||||||
|
DISCO_UNLOCK (dc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1696,6 +1707,10 @@ discoverer_cleanup (GstDiscoverer * dc)
|
||||||
{
|
{
|
||||||
GST_DEBUG ("Cleaning up");
|
GST_DEBUG ("Cleaning up");
|
||||||
|
|
||||||
|
DISCO_LOCK (dc);
|
||||||
|
dc->priv->cleanup = TRUE;
|
||||||
|
DISCO_UNLOCK (dc);
|
||||||
|
|
||||||
gst_bus_set_flushing (dc->priv->bus, TRUE);
|
gst_bus_set_flushing (dc->priv->bus, TRUE);
|
||||||
|
|
||||||
DISCO_LOCK (dc);
|
DISCO_LOCK (dc);
|
||||||
|
@ -1724,6 +1739,8 @@ discoverer_cleanup (GstDiscoverer * dc)
|
||||||
dc->priv->current_state = GST_STATE_NULL;
|
dc->priv->current_state = GST_STATE_NULL;
|
||||||
dc->priv->target_state = GST_STATE_NULL;
|
dc->priv->target_state = GST_STATE_NULL;
|
||||||
dc->priv->no_more_pads = FALSE;
|
dc->priv->no_more_pads = FALSE;
|
||||||
|
dc->priv->cleanup = FALSE;
|
||||||
|
|
||||||
|
|
||||||
/* Try popping the next uri */
|
/* Try popping the next uri */
|
||||||
if (dc->priv->async) {
|
if (dc->priv->async) {
|
||||||
|
|
Loading…
Reference in a new issue