gst/playback/gstdecodebin.c: Make the window for a race in typefind and shutting down smaller until we figure out the...

Original commit message from CVS:
* gst/playback/gstdecodebin.c: (new_pad), (type_found):
Make the window for a race in typefind and shutting down smaller until
we figure out the right locking here. Avoids #485753 usually.
* gst/playback/gstdecodebin2.c: (type_found), (pad_added_group_cb):
Remove unneeded lock causing a race in typefind and shutting down.
Fixes #485753.
* gst/playback/gstplaybin.c: (gst_play_bin_change_state):
Also remove sinks when going to NULL because we might not complete the
state change to PAUSED, causing the PAUSED->READY state change not to
happen.
This commit is contained in:
Wim Taymans 2007-10-16 16:48:38 +00:00
parent 6a20747e83
commit d33d2be0ed
4 changed files with 33 additions and 5 deletions

View file

@ -1,3 +1,18 @@
2007-10-16 Wim Taymans <wim.taymans@gmail.com>
* gst/playback/gstdecodebin.c: (new_pad), (type_found):
Make the window for a race in typefind and shutting down smaller until
we figure out the right locking here. Avoids #485753 usually.
* gst/playback/gstdecodebin2.c: (type_found), (pad_added_group_cb):
Remove unneeded lock causing a race in typefind and shutting down.
Fixes #485753.
* gst/playback/gstplaybin.c: (gst_play_bin_change_state):
Also remove sinks when going to NULL because we might not complete the
state change to PAUSED, causing the PAUSED->READY state change not to
happen.
2007-10-16 Wim Taymans <wim.taymans@gmail.com>
* gst-libs/gst/audio/gstbaseaudiosink.c:

View file

@ -1261,11 +1261,13 @@ new_pad (GstElement * element, GstPad * pad, GstDynamic * dynamic)
shutting_down1:
{
GST_DEBUG_OBJECT (decode_bin, "we are shutting down");
GST_OBJECT_UNLOCK (decode_bin);
return;
}
shutting_down2:
{
GST_DEBUG_OBJECT (decode_bin, "we are shutting down");
GST_STATE_UNLOCK (decode_bin);
return;
}
@ -1537,6 +1539,13 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
gboolean dynamic;
GstPad *pad;
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
GST_OBJECT_LOCK (decode_bin);
if (decode_bin->shutting_down)
goto shutting_down;
GST_OBJECT_UNLOCK (decode_bin);
GST_STATE_LOCK (decode_bin);
if (decode_bin->shutting_down)
goto exit;
@ -1548,8 +1557,6 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
decode_bin->have_type = TRUE;
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
/* special-case text/plain: we only want to accept it as a raw type if it
* comes from a subtitel parser element or a demuxer, but not if it is the
* type of the entire stream, in which case we just want to error out */
@ -1582,6 +1589,13 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
exit:
GST_STATE_UNLOCK (decode_bin);
return;
shutting_down:
{
GST_DEBUG_OBJECT (decode_bin, "we are shutting down");
GST_OBJECT_UNLOCK (decode_bin);
return;
}
}
static void

View file

@ -1143,8 +1143,6 @@ type_found (GstElement * typefind, guint probability,
{
GstPad *pad;
GST_STATE_LOCK (decode_bin);
GST_DEBUG_OBJECT (decode_bin, "typefind found caps %" GST_PTR_FORMAT, caps);
/* we can only deal with one type, we don't yet support dynamically changing
@ -1161,7 +1159,6 @@ type_found (GstElement * typefind, guint probability,
gst_object_unref (pad);
exit:
GST_STATE_UNLOCK (decode_bin);
return;
}
@ -1184,6 +1181,7 @@ pad_added_group_cb (GstElement * element, GstPad * pad, GstDecodeGroup * group)
if (group->nbdynamic == 0)
expose = TRUE;
GROUP_MUTEX_UNLOCK (group);
if (expose) {
GST_LOG
("That was the last dynamic object, now attempting to expose the group");

View file

@ -1812,6 +1812,7 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
/* FIXME Release audio device when we implement that */
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
case GST_STATE_CHANGE_READY_TO_NULL:
/* remove sinks we added */
remove_sinks (play_bin);
/* and there might be a fakesink we need to clean up now */