mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
python: Fix some locking problems
Add some python pyg_begin_allow_threads/end_allow_threads when calling into some gstreamer functions that might call into python.
This commit is contained in:
parent
ec692ee329
commit
777a4d59ec
3 changed files with 21 additions and 7 deletions
|
@ -232,7 +232,10 @@ pad_name_from_object (PyObject *object, const gchar **name)
|
|||
*name = PyString_AsString (object);
|
||||
return TRUE;
|
||||
} else if (pygobject_check (object, &PyGstPad_Type)) {
|
||||
*name = gst_object_get_name (GST_OBJECT (pygobject_get (object)));
|
||||
GstObject *obj = GST_OBJECT (pygobject_get (object));
|
||||
pyg_begin_allow_threads;
|
||||
*name = gst_object_get_name (obj);
|
||||
pyg_end_allow_threads;
|
||||
return TRUE;
|
||||
}
|
||||
PyErr_SetString(PyExc_TypeError, "argument could not be converted to a pad");
|
||||
|
|
|
@ -35,7 +35,13 @@ _wrap_gst_message_tp_repr (PyGstMiniObject *self)
|
|||
|
||||
structure_str = msg->structure ? gst_structure_to_string (msg->structure)
|
||||
: g_strdup ("(none)");
|
||||
src_str = msg->src ? gst_object_get_name (msg->src) : g_strdup ("(no src)");
|
||||
if (msg->src) {
|
||||
pyg_begin_allow_threads;
|
||||
src_str = gst_object_get_name (msg->src);
|
||||
pyg_end_allow_threads;
|
||||
} else {
|
||||
src_str = g_strdup ("(no src)");
|
||||
}
|
||||
|
||||
repr = g_strdup_printf ("<gst.Message %s from %s at %p>",
|
||||
structure_str, src_str, msg);
|
||||
|
|
|
@ -656,9 +656,11 @@ _wrap_gst_pad_tp_repr (PyGObject *self)
|
|||
gchar *elementname = NULL;
|
||||
|
||||
pad = GST_PAD(self->obj);
|
||||
parent = GST_ELEMENT (gst_pad_get_parent (pad));
|
||||
|
||||
pyg_begin_allow_threads;
|
||||
padname = gst_pad_get_name (pad);
|
||||
|
||||
parent = GST_ELEMENT (gst_pad_get_parent (pad));
|
||||
if (parent)
|
||||
elementname = gst_element_get_name (parent);
|
||||
|
||||
|
@ -666,14 +668,17 @@ _wrap_gst_pad_tp_repr (PyGObject *self)
|
|||
parent ? elementname : "---",
|
||||
padname, (long) self->obj);
|
||||
|
||||
g_free(padname);
|
||||
|
||||
if (parent) {
|
||||
gst_object_unref (parent);
|
||||
g_free(elementname);
|
||||
}
|
||||
g_free(padname);
|
||||
pyg_end_allow_threads;
|
||||
|
||||
retval = PyString_FromString(buf);
|
||||
g_free(buf);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue