mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
gst/base/gstbasesink.c (gst_base_sink_activate_pull): Fix a race condition whereby the pad's task function is entered...
Original commit message from CVS: 2005-09-07 Andy Wingo <wingo@pobox.com> * gst/base/gstbasesink.c (gst_base_sink_activate_pull): Fix a race condition whereby the pad's task function is entered before the pad_mode variable was set.
This commit is contained in:
parent
9f96921e90
commit
c477a458d7
3 changed files with 24 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-09-07 Andy Wingo <wingo@pobox.com>
|
||||||
|
|
||||||
|
* gst/base/gstbasesink.c (gst_base_sink_activate_pull): Fix a race
|
||||||
|
condition whereby the pad's task function is entered before the
|
||||||
|
pad_mode variable was set.
|
||||||
|
|
||||||
2005-09-07 Jan Schmidt <thaytan@mad.scientist.com>
|
2005-09-07 Jan Schmidt <thaytan@mad.scientist.com>
|
||||||
|
|
||||||
* gst/gstpad.c: (gst_pad_alloc_buffer):
|
* gst/gstpad.c: (gst_pad_alloc_buffer):
|
||||||
|
|
|
@ -1232,21 +1232,28 @@ gst_base_sink_activate_pull (GstPad * pad, gboolean active)
|
||||||
if (G_UNLIKELY (peer == NULL)) {
|
if (G_UNLIKELY (peer == NULL)) {
|
||||||
g_warning ("Trying to activate pad in pull mode, but no peer");
|
g_warning ("Trying to activate pad in pull mode, but no peer");
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_NONE;
|
||||||
} else {
|
} else {
|
||||||
if (gst_pad_activate_pull (peer, TRUE)) {
|
if (gst_pad_activate_pull (peer, TRUE)) {
|
||||||
basesink->have_newsegment = TRUE;
|
basesink->have_newsegment = TRUE;
|
||||||
basesink->segment_start = basesink->segment_stop = 0;
|
basesink->segment_start = basesink->segment_stop = 0;
|
||||||
|
|
||||||
|
/* set the pad mode before starting the task so that it's in the
|
||||||
|
correct state for the new thread... */
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_PULL;
|
||||||
result =
|
result =
|
||||||
gst_pad_start_task (pad, (GstTaskFunction) gst_base_sink_loop,
|
gst_pad_start_task (pad, (GstTaskFunction) gst_base_sink_loop,
|
||||||
pad);
|
pad);
|
||||||
|
/* but if starting the thread fails, set it back */
|
||||||
|
if (!result)
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_NONE;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (pad, "Failed to activate peer in pull mode");
|
GST_DEBUG_OBJECT (pad, "Failed to activate peer in pull mode");
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_NONE;
|
||||||
}
|
}
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
basesink->pad_mode = result ? GST_ACTIVATE_PULL : GST_ACTIVATE_NONE;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (G_UNLIKELY (basesink->pad_mode != GST_ACTIVATE_PULL)) {
|
if (G_UNLIKELY (basesink->pad_mode != GST_ACTIVATE_PULL)) {
|
||||||
|
|
|
@ -1232,21 +1232,28 @@ gst_base_sink_activate_pull (GstPad * pad, gboolean active)
|
||||||
if (G_UNLIKELY (peer == NULL)) {
|
if (G_UNLIKELY (peer == NULL)) {
|
||||||
g_warning ("Trying to activate pad in pull mode, but no peer");
|
g_warning ("Trying to activate pad in pull mode, but no peer");
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_NONE;
|
||||||
} else {
|
} else {
|
||||||
if (gst_pad_activate_pull (peer, TRUE)) {
|
if (gst_pad_activate_pull (peer, TRUE)) {
|
||||||
basesink->have_newsegment = TRUE;
|
basesink->have_newsegment = TRUE;
|
||||||
basesink->segment_start = basesink->segment_stop = 0;
|
basesink->segment_start = basesink->segment_stop = 0;
|
||||||
|
|
||||||
|
/* set the pad mode before starting the task so that it's in the
|
||||||
|
correct state for the new thread... */
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_PULL;
|
||||||
result =
|
result =
|
||||||
gst_pad_start_task (pad, (GstTaskFunction) gst_base_sink_loop,
|
gst_pad_start_task (pad, (GstTaskFunction) gst_base_sink_loop,
|
||||||
pad);
|
pad);
|
||||||
|
/* but if starting the thread fails, set it back */
|
||||||
|
if (!result)
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_NONE;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (pad, "Failed to activate peer in pull mode");
|
GST_DEBUG_OBJECT (pad, "Failed to activate peer in pull mode");
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
|
basesink->pad_mode = GST_ACTIVATE_NONE;
|
||||||
}
|
}
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
basesink->pad_mode = result ? GST_ACTIVATE_PULL : GST_ACTIVATE_NONE;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (G_UNLIKELY (basesink->pad_mode != GST_ACTIVATE_PULL)) {
|
if (G_UNLIKELY (basesink->pad_mode != GST_ACTIVATE_PULL)) {
|
||||||
|
|
Loading…
Reference in a new issue