gst/gstpad.c (gst_pad_activate_push): There is a race condition whereby calling a pad's activatepush() function can s...

Original commit message from CVS:
2005-10-03  Andy Wingo  <wingo@pobox.com>

* gst/gstpad.c (gst_pad_activate_push): There is a race condition
whereby calling a pad's activatepush() function can start a thread
that starts to push or pull before the pad gets the FLUSHING flag
unset. Hack around it by holding the stream lock until the flag is
set. Need to replace this with a proper solution. Together with
the ghost pad fixes, this fixes mp3 playing/tagreading.
This commit is contained in:
Andy Wingo 2005-10-02 23:24:25 +00:00
parent 7b469c4368
commit 60f3c2b541
2 changed files with 20 additions and 1 deletions

View file

@ -1,5 +1,12 @@
2005-10-03 Andy Wingo <wingo@pobox.com>
* gst/gstpad.c (gst_pad_activate_push): There is a race condition
whereby calling a pad's activatepush() function can start a thread
that starts to push or pull before the pad gets the FLUSHING flag
unset. Hack around it by holding the stream lock until the flag is
set. Need to replace this with a proper solution. Together with
the ghost pad fixes, this fixes mp3 playing/tagreading.
* docs/design/part-gstghostpad.txt: Add a note about activation of
proxy pads outside of ghost pads.

View file

@ -490,7 +490,7 @@ post_activate_switch (GstPad * pad, gboolean new_active)
GST_PAD_UNSET_FLUSHING (pad);
GST_UNLOCK (pad);
} else {
/* make streaming stop */
/* ensures that streaming stops */
GST_STREAM_LOCK (pad);
GST_STREAM_UNLOCK (pad);
}
@ -688,6 +688,10 @@ gst_pad_activate_push (GstPad * pad, gboolean active)
pre_activate_switch (pad, active);
/* terrible hack */
if (active)
GST_STREAM_LOCK (pad);
if (GST_PAD_ACTIVATEPUSHFUNC (pad)) {
if (GST_PAD_ACTIVATEPUSHFUNC (pad) (pad, active)) {
goto success;
@ -714,6 +718,10 @@ success:
GST_UNLOCK (pad);
post_activate_switch (pad, active);
/* terrible hack */
if (active)
GST_STREAM_UNLOCK (pad);
GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "%s in push mode",
active ? "activated" : "deactivated");
return TRUE;
@ -721,6 +729,10 @@ success:
failure:
{
/* terrible hack */
if (active)
GST_STREAM_UNLOCK (pad);
GST_CAT_INFO_OBJECT (GST_CAT_PADS, pad, "failed to %s in push mode",
active ? "activate" : "deactivate");
return FALSE;