discoverer: Don't remove element when switching to PLAYING

There is a race going on somewhere when we attempt to remove elements
*while* the parent container is switching to PLAYING.

In order to avoid this issue with discoverer, make sure we never
remove elements while switching to PLAYING.
This commit is contained in:
Edward Hervey 2017-11-15 10:51:33 +01:00 committed by Edward Hervey
parent 9c4b3b1ee7
commit 4c2f91d69e

View file

@ -743,7 +743,6 @@ uridecodebin_pad_removed_cb (GstElement * uridecodebin, GstPad * pad,
gst_pad_remove_probe (pad, ps->probe_id);
dc->priv->streams = g_list_delete_link (dc->priv->streams, tmp);
DISCO_UNLOCK (dc);
gst_element_set_state (ps->sink, GST_STATE_NULL);
gst_element_set_state (ps->queue, GST_STATE_NULL);
@ -756,6 +755,7 @@ uridecodebin_pad_removed_cb (GstElement * uridecodebin, GstPad * pad,
/* references removed here */
gst_bin_remove_many (dc->priv->pipeline, ps->sink, ps->queue, NULL);
DISCO_UNLOCK (dc);
if (ps->tags) {
gst_tag_list_unref (ps->tags);
}
@ -1340,7 +1340,10 @@ discoverer_collect (GstDiscoverer * dc)
* completely bogus values. We need some API extensions to solve this
* better. */
GST_INFO ("No duration yet, try a bit harder..");
/* Make sure we don't add/remove elements while switching to PLAYING itself */
DISCO_LOCK (dc);
sret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
DISCO_UNLOCK (dc);
if (sret != GST_STATE_CHANGE_FAILURE) {
int i;