pipeline: Remove the dynamic lock

We actually do not need it has everywhere where we would need it we are
already locked against the timeline.dyn_lock, we need to make sure it is
always the case in the future.

The hierarchy of the mutex was wrong and could possibly lead to
deadlocks
This commit is contained in:
Thibault Saunier 2013-08-19 15:13:48 -04:00
parent 41d86292c9
commit 0c87104955

View file

@ -37,24 +37,6 @@
#define DEFAULT_TIMELINE_MODE TIMELINE_MODE_PREVIEW
/* lock to protect dynamic callbacks, like pad-added or nmp */
#define DYN_LOCK(pipeline) (&GES_TIMELINE_PIPELINE (pipeline)->priv->dyn_mutex)
#define LOCK_DYN(pipeline) G_STMT_START { \
GST_INFO_OBJECT (pipeline, "Getting dynamic lock from %p", \
g_thread_self()); \
g_mutex_lock (DYN_LOCK (pipeline)); \
GST_INFO_OBJECT (pipeline, "Got Dynamic lock from %p", \
g_thread_self()); \
} G_STMT_END
#define UNLOCK_DYN(pipeline) G_STMT_START { \
GST_INFO_OBJECT (pipeline, "Unlocking dynamic lock from %p", \
g_thread_self()); \
g_mutex_unlock (DYN_LOCK (pipeline)); \
GST_INFO_OBJECT (pipeline, "Unlocked Dynamic lock from %p", \
g_thread_self()); \
} G_STMT_END
/* Structure corresponding to a timeline - sink link */
typedef struct
@ -481,7 +463,6 @@ new_output_chain_for_track (GESPipeline * self, GESTrack * track)
return chain;
}
/* Should be called with LOCK_DYN */
static OutputChain *
get_output_chain_for_track (GESPipeline * self, GESTrack * track)
{
@ -580,7 +561,6 @@ pad_added_cb (GstElement * timeline, GstPad * pad, GESPipeline * self)
GstCaps *caps;
gboolean reconfigured = FALSE;
LOCK_DYN (self);
caps = gst_pad_query_caps (pad, NULL);
GST_DEBUG_OBJECT (self, "new pad %s:%s , caps:%" GST_PTR_FORMAT,
@ -592,7 +572,6 @@ pad_added_cb (GstElement * timeline, GstPad * pad, GESPipeline * self)
if (G_UNLIKELY (!track)) {
GST_WARNING_OBJECT (self, "Couldn't find coresponding track !");
UNLOCK_DYN (self);
return;
}
@ -718,7 +697,6 @@ pad_added_cb (GstElement * timeline, GstPad * pad, GESPipeline * self)
if (!get_output_chain_for_track (self, track))
self->priv->chains = g_list_append (self->priv->chains, chain);
UNLOCK_DYN (self);
GST_DEBUG ("done");
return;
@ -730,7 +708,6 @@ error:
if (sinkpad)
gst_object_unref (sinkpad);
g_free (chain);
UNLOCK_DYN (self);
}
}
@ -741,19 +718,16 @@ pad_removed_cb (GstElement * timeline, GstPad * pad, GESPipeline * self)
GESTrack *track;
GstPad *peer;
LOCK_DYN (self);
GST_DEBUG_OBJECT (self, "pad removed %s:%s", GST_DEBUG_PAD_NAME (pad));
if (G_UNLIKELY (!(track =
ges_timeline_get_track_for_pad (self->priv->timeline, pad)))) {
GST_WARNING_OBJECT (self, "Couldn't find coresponding track !");
UNLOCK_DYN (self);
return;
}
if (G_UNLIKELY (!(chain = get_output_chain_for_track (self, track)))) {
GST_DEBUG_OBJECT (self, "Pad wasn't used");
UNLOCK_DYN (self);
return;
}
@ -792,7 +766,6 @@ pad_removed_cb (GstElement * timeline, GstPad * pad, GESPipeline * self)
self->priv->chains = g_list_remove (self->priv->chains, chain);
g_free (chain);
UNLOCK_DYN (self);
GST_DEBUG ("done");
}
@ -803,7 +776,6 @@ no_more_pads_cb (GstElement * timeline, GESPipeline * self)
GList *tmp;
GST_DEBUG ("received no-more-pads");
LOCK_DYN (self);
for (tmp = self->priv->chains; tmp; tmp = g_list_next (tmp)) {
OutputChain *chain = (OutputChain *) tmp->data;
@ -815,7 +787,6 @@ no_more_pads_cb (GstElement * timeline, GESPipeline * self)
chain->probe_id = 0;
}
}
UNLOCK_DYN (self);
}
/**