diff --git a/ChangeLog b/ChangeLog index 286a14a3ad..e50b4ef17a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-10-16 Wim Taymans + + * 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 * gst-libs/gst/audio/gstbaseaudiosink.c: diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index 68228dba0f..b3f4bee804 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -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 diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index c403f4127f..f66eb74ee8 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -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"); diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index 794c4067fa..209bec9fef 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -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 */