mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 15:06:34 +00:00
nlecomposition: Fix race condition in seek handling causing deadlocks
We might receive another seek from the application while the action task is handling a previous seek (and thus setting seeking_itself to TRUE). To prevent this seek to go through directly instead of being added as an action, also check if the seek event was received from our action task thread or some other thread. https://bugzilla.gnome.org/show_bug.cgi?id=767053
This commit is contained in:
parent
2aac7356c8
commit
2ef72b7276
1 changed files with 11 additions and 1 deletions
|
@ -1558,13 +1558,23 @@ nle_composition_event_handler (GstPad * ghostpad, GstObject * parent,
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_SEEK:
|
case GST_EVENT_SEEK:
|
||||||
{
|
{
|
||||||
if (!priv->seeking_itself) {
|
/* Queue up a seek action if this seek event does not come from
|
||||||
|
* ourselves. Due to a possible race condition around the
|
||||||
|
* seeking_itself flag, we also check if the seek comes from
|
||||||
|
* our task thread. The seeking_itself flag only works as an
|
||||||
|
* optimization */
|
||||||
|
GST_OBJECT_LOCK (comp);
|
||||||
|
if (!priv->seeking_itself || (comp->task
|
||||||
|
&& gst_task_get_state (comp->task) != GST_TASK_STOPPED
|
||||||
|
&& g_thread_self () != comp->task->thread)) {
|
||||||
|
GST_OBJECT_UNLOCK (comp);
|
||||||
_add_seek_action (comp, event);
|
_add_seek_action (comp, event);
|
||||||
event = NULL;
|
event = NULL;
|
||||||
GST_FIXME_OBJECT (comp, "HANDLE seeking errors!");
|
GST_FIXME_OBJECT (comp, "HANDLE seeking errors!");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
GST_OBJECT_UNLOCK (comp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_EVENT_QOS:
|
case GST_EVENT_QOS:
|
||||||
|
|
Loading…
Reference in a new issue