+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>
* win32/common/libgsttag.def:
play_base_bin->subtitle = NULL;
play_base_bin->subencoding = 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_cond = g_cond_new ();
g_mutex_free (play_base_bin->group_lock);
g_cond_free (play_base_bin->group_cond);
+ g_mutex_free (play_base_bin->sub_lock);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
return;
}
- GST_OBJECT_LOCK (play_base_bin);
+ g_mutex_lock (play_base_bin->sub_lock);
play_base_bin->subtitle_elements =
g_slist_append (play_base_bin->subtitle_elements, element);
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);
g_free (encoding);
{
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 =
g_slist_remove (play_base_bin->subtitle_elements, element);
- GST_OBJECT_UNLOCK (play_base_bin);
+ g_mutex_unlock (play_base_bin->sub_lock);
}
if (encoding == NULL && play_base_bin->subencoding == NULL)
return;
- GST_OBJECT_LOCK (play_base_bin);
+ g_mutex_lock (play_base_bin->sub_lock);
g_free (play_base_bin->subencoding);
play_base_bin->subencoding = g_strdup (encoding);
list = g_slist_copy (play_base_bin->subtitle_elements);
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
* the notify event will trigger GstObject to send a deep-notify event
GstElement *decoder;
GstElement *subtitle; /* additional filesrc ! subparse bin */
gboolean subtitle_done;
+ gboolean need_rebuild;
+
GSList *subtitle_elements; /* subtitle elements that have 'subtitle-encoding' property */
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 */
GMutex *group_lock; /* lock and mutex to signal availability of new group */