mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-30 11:08:34 +00:00
gst/playback/gstplaybasebin.*: Protect list of elements with a subtitle-encoding property and the subtitle encoding m...
Original commit message from CVS: * gst/playback/gstplaybasebin.c: (gst_play_base_bin_init), (gst_play_base_bin_finalize), (decodebin_element_added_cb), (decodebin_element_removed_cb), (gst_play_base_bin_set_property): * gst/playback/gstplaybasebin.h: Protect list of elements with a subtitle-encoding property and the subtitle encoding member itself with a lock of their own instead of using the object lock. This prevents a dead-lock in the element-remove callback in some circumstances when shutting down playbin.
This commit is contained in:
parent
8f89dbc65e
commit
f1318291ed
3 changed files with 24 additions and 7 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2006-07-06 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
|
||||||
|
(gst_play_base_bin_finalize), (decodebin_element_added_cb),
|
||||||
|
(decodebin_element_removed_cb), (gst_play_base_bin_set_property):
|
||||||
|
* gst/playback/gstplaybasebin.h:
|
||||||
|
Protect list of elements with a subtitle-encoding property and
|
||||||
|
the subtitle encoding member itself with a lock of their own
|
||||||
|
instead of using the object lock. This prevents a dead-lock in
|
||||||
|
the element-remove callback in some circumstances when shutting
|
||||||
|
down playbin.
|
||||||
|
|
||||||
2006-07-05 Sebastien Moutte <sebastien@moutte.net>
|
2006-07-05 Sebastien Moutte <sebastien@moutte.net>
|
||||||
|
|
||||||
* win32/common/libgsttag.def:
|
* win32/common/libgsttag.def:
|
||||||
|
|
|
@ -217,6 +217,7 @@ gst_play_base_bin_init (GstPlayBaseBin * play_base_bin)
|
||||||
play_base_bin->subtitle = NULL;
|
play_base_bin->subtitle = NULL;
|
||||||
play_base_bin->subencoding = NULL;
|
play_base_bin->subencoding = NULL;
|
||||||
play_base_bin->subtitle_elements = NULL;
|
play_base_bin->subtitle_elements = NULL;
|
||||||
|
play_base_bin->sub_lock = g_mutex_new ();
|
||||||
|
|
||||||
play_base_bin->group_lock = g_mutex_new ();
|
play_base_bin->group_lock = g_mutex_new ();
|
||||||
play_base_bin->group_cond = g_cond_new ();
|
play_base_bin->group_cond = g_cond_new ();
|
||||||
|
@ -255,6 +256,8 @@ gst_play_base_bin_finalize (GObject * object)
|
||||||
g_mutex_free (play_base_bin->group_lock);
|
g_mutex_free (play_base_bin->group_lock);
|
||||||
g_cond_free (play_base_bin->group_cond);
|
g_cond_free (play_base_bin->group_cond);
|
||||||
|
|
||||||
|
g_mutex_free (play_base_bin->sub_lock);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1195,11 +1198,11 @@ decodebin_element_added_cb (GstBin * decodebin, GstElement * element,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_OBJECT_LOCK (play_base_bin);
|
g_mutex_lock (play_base_bin->sub_lock);
|
||||||
play_base_bin->subtitle_elements =
|
play_base_bin->subtitle_elements =
|
||||||
g_slist_append (play_base_bin->subtitle_elements, element);
|
g_slist_append (play_base_bin->subtitle_elements, element);
|
||||||
encoding = g_strdup (play_base_bin->subencoding);
|
encoding = g_strdup (play_base_bin->subencoding);
|
||||||
GST_OBJECT_UNLOCK (play_base_bin);
|
g_mutex_unlock (play_base_bin->sub_lock);
|
||||||
|
|
||||||
set_encoding_element (element, encoding);
|
set_encoding_element (element, encoding);
|
||||||
g_free (encoding);
|
g_free (encoding);
|
||||||
|
@ -1211,10 +1214,10 @@ decodebin_element_removed_cb (GstBin * decodebin, GstElement * element,
|
||||||
{
|
{
|
||||||
GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (data);
|
GstPlayBaseBin *play_base_bin = GST_PLAY_BASE_BIN (data);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (play_base_bin);
|
g_mutex_lock (play_base_bin->sub_lock);
|
||||||
play_base_bin->subtitle_elements =
|
play_base_bin->subtitle_elements =
|
||||||
g_slist_remove (play_base_bin->subtitle_elements, element);
|
g_slist_remove (play_base_bin->subtitle_elements, element);
|
||||||
GST_OBJECT_UNLOCK (play_base_bin);
|
g_mutex_unlock (play_base_bin->sub_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1923,12 +1926,12 @@ gst_play_base_bin_set_property (GObject * object, guint prop_id,
|
||||||
if (encoding == NULL && play_base_bin->subencoding == NULL)
|
if (encoding == NULL && play_base_bin->subencoding == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (play_base_bin);
|
g_mutex_lock (play_base_bin->sub_lock);
|
||||||
g_free (play_base_bin->subencoding);
|
g_free (play_base_bin->subencoding);
|
||||||
play_base_bin->subencoding = g_strdup (encoding);
|
play_base_bin->subencoding = g_strdup (encoding);
|
||||||
list = g_slist_copy (play_base_bin->subtitle_elements);
|
list = g_slist_copy (play_base_bin->subtitle_elements);
|
||||||
g_slist_foreach (list, (GFunc) gst_object_ref, NULL);
|
g_slist_foreach (list, (GFunc) gst_object_ref, NULL);
|
||||||
GST_OBJECT_UNLOCK (play_base_bin);
|
g_mutex_unlock (play_base_bin->sub_lock);
|
||||||
|
|
||||||
/* we can't hold a lock when calling g_object_set() on a child, since
|
/* we can't hold a lock when calling g_object_set() on a child, since
|
||||||
* the notify event will trigger GstObject to send a deep-notify event
|
* the notify event will trigger GstObject to send a deep-notify event
|
||||||
|
|
|
@ -81,9 +81,11 @@ struct _GstPlayBaseBin {
|
||||||
GstElement *decoder;
|
GstElement *decoder;
|
||||||
GstElement *subtitle; /* additional filesrc ! subparse bin */
|
GstElement *subtitle; /* additional filesrc ! subparse bin */
|
||||||
gboolean subtitle_done;
|
gboolean subtitle_done;
|
||||||
|
gboolean need_rebuild;
|
||||||
|
|
||||||
GSList *subtitle_elements; /* subtitle elements that have 'subtitle-encoding' property */
|
GSList *subtitle_elements; /* subtitle elements that have 'subtitle-encoding' property */
|
||||||
gchar *subencoding; /* encoding to propagate to the above subtitle elements */
|
gchar *subencoding; /* encoding to propagate to the above subtitle elements */
|
||||||
gboolean need_rebuild;
|
GMutex *sub_lock; /* protecting subtitle_elements and subencoding members */
|
||||||
|
|
||||||
/* group management - using own lock */
|
/* group management - using own lock */
|
||||||
GMutex *group_lock; /* lock and mutex to signal availability of new group */
|
GMutex *group_lock; /* lock and mutex to signal availability of new group */
|
||||||
|
|
Loading…
Reference in a new issue