mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
discoverer: Drop new stream tags once preroll is done
This makes sure we do not touch the stream taglist once the pipeline has been prerolled. Adding of stream tags happens in the pad event probe which runs in a different thread from discoverer stream processing, so modifying the tag list while discoverer might be processing it can sometimes cause a crash. https://bugzilla.gnome.org/show_bug.cgi?id=639778
This commit is contained in:
parent
65a298fdee
commit
6ac2e5d384
1 changed files with 12 additions and 4 deletions
|
@ -393,10 +393,15 @@ _event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
|
|||
gst_event_parse_tag (event, &tl);
|
||||
GST_DEBUG_OBJECT (pad, "tags %" GST_PTR_FORMAT, tl);
|
||||
DISCO_LOCK (ps->dc);
|
||||
tmp = gst_tag_list_merge (ps->tags, tl, GST_TAG_MERGE_APPEND);
|
||||
if (ps->tags)
|
||||
gst_tag_list_free (ps->tags);
|
||||
ps->tags = tmp;
|
||||
/* If preroll is complete, drop these tags - the collected information is
|
||||
* possibly already being processed and adding more tags would be racy */
|
||||
if (G_LIKELY (ps->dc->priv->processing)) {
|
||||
tmp = gst_tag_list_merge (ps->tags, tl, GST_TAG_MERGE_APPEND);
|
||||
if (ps->tags)
|
||||
gst_tag_list_free (ps->tags);
|
||||
ps->tags = tmp;
|
||||
} else
|
||||
GST_DEBUG_OBJECT (ps->dc, "Dropping tags since preroll is done");
|
||||
DISCO_UNLOCK (ps->dc);
|
||||
}
|
||||
|
||||
|
@ -1143,7 +1148,10 @@ discoverer_bus_cb (GstBus * bus, GstMessage * msg, GstDiscoverer * dc)
|
|||
if (dc->priv->processing) {
|
||||
if (handle_message (dc, msg)) {
|
||||
GST_DEBUG ("Stopping asynchronously");
|
||||
/* Serialise with _event_probe() */
|
||||
DISCO_LOCK (dc);
|
||||
dc->priv->processing = FALSE;
|
||||
DISCO_UNLOCK (dc);
|
||||
discoverer_collect (dc);
|
||||
discoverer_cleanup (dc);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue