Commit a38ee070 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

playback: Hold the state lock while posting async-start/done messages

Otherwise another state change might happen in the meantime and confuse
the internal tracking of the state.
parent a52ad207
Pipeline #14420 failed with stages
in 24 minutes and 55 seconds
......@@ -5179,10 +5179,12 @@ do_async_start (GstDecodeBin * dbin)
{
GstMessage *message;
GST_STATE_LOCK (dbin);
dbin->async_pending = TRUE;
message = gst_message_new_async_start (GST_OBJECT_CAST (dbin));
parent_class->handle_message (GST_BIN_CAST (dbin), message);
GST_STATE_UNLOCK (dbin);
}
static void
......@@ -5190,6 +5192,7 @@ do_async_done (GstDecodeBin * dbin)
{
GstMessage *message;
GST_STATE_LOCK (dbin);
if (dbin->async_pending) {
message =
gst_message_new_async_done (GST_OBJECT_CAST (dbin),
......@@ -5198,6 +5201,7 @@ do_async_done (GstDecodeBin * dbin)
dbin->async_pending = FALSE;
}
GST_STATE_UNLOCK (dbin);
}
/*****
......
......@@ -1344,11 +1344,13 @@ do_async_start (GstPlayBin * playbin)
{
GstMessage *message;
GST_STATE_LOCK (playbin);
playbin->async_pending = TRUE;
message = gst_message_new_async_start (GST_OBJECT_CAST (playbin));
GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (playbin),
message);
GST_STATE_UNLOCK (playbin);
}
static void
......@@ -1356,6 +1358,7 @@ do_async_done (GstPlayBin * playbin)
{
GstMessage *message;
GST_STATE_LOCK (playbin);
if (playbin->async_pending) {
GST_DEBUG_OBJECT (playbin, "posting ASYNC_DONE");
message =
......@@ -1366,6 +1369,7 @@ do_async_done (GstPlayBin * playbin)
playbin->async_pending = FALSE;
}
GST_STATE_UNLOCK (playbin);
}
static void
......
......@@ -1072,11 +1072,13 @@ do_async_start (GstPlayBin3 * playbin)
{
GstMessage *message;
GST_STATE_LOCK (playbin);
playbin->async_pending = TRUE;
message = gst_message_new_async_start (GST_OBJECT_CAST (playbin));
GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (playbin),
message);
GST_STATE_UNLOCK (playbin);
}
static void
......@@ -1084,6 +1086,7 @@ do_async_done (GstPlayBin3 * playbin)
{
GstMessage *message;
GST_STATE_LOCK (playbin);
if (playbin->async_pending) {
GST_DEBUG_OBJECT (playbin, "posting ASYNC_DONE");
message =
......@@ -1094,6 +1097,7 @@ do_async_done (GstPlayBin3 * playbin)
playbin->async_pending = FALSE;
}
GST_STATE_UNLOCK (playbin);
}
/* init combiners. The combiner is found by finding the first prefix that
......
......@@ -1429,8 +1429,10 @@ do_async_start (GstPlaySink * playsink)
{
GstMessage *message;
GST_STATE_LOCK (playsink);
if (!playsink->need_async_start) {
GST_INFO_OBJECT (playsink, "no async_start needed");
GST_STATE_UNLOCK (playsink);
return;
}
......@@ -1440,6 +1442,7 @@ do_async_start (GstPlaySink * playsink)
message = gst_message_new_async_start (GST_OBJECT_CAST (playsink));
GST_BIN_CLASS (gst_play_sink_parent_class)->handle_message (GST_BIN_CAST
(playsink), message);
GST_STATE_UNLOCK (playsink);
}
static void
......@@ -1447,6 +1450,7 @@ do_async_done (GstPlaySink * playsink)
{
GstMessage *message;
GST_STATE_LOCK (playsink);
if (playsink->async_pending) {
GST_INFO_OBJECT (playsink, "Sending async_done message");
message =
......@@ -1459,6 +1463,7 @@ do_async_done (GstPlaySink * playsink)
}
playsink->need_async_start = FALSE;
GST_STATE_UNLOCK (playsink);
}
/* try to change the state of an element. This function returns the element when
......
......@@ -88,6 +88,7 @@ static GQuark _subtitle_overlay_event_marker_id = 0;
static void
do_async_start (GstSubtitleOverlay * self)
{
GST_STATE_LOCK (self);
if (!self->do_async) {
GstMessage *msg = gst_message_new_async_start (GST_OBJECT_CAST (self));
......@@ -95,11 +96,13 @@ do_async_start (GstSubtitleOverlay * self)
GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (self), msg);
self->do_async = TRUE;
}
GST_STATE_UNLOCK (self);
}
static void
do_async_done (GstSubtitleOverlay * self)
{
GST_STATE_LOCK (self);
if (self->do_async) {
GstMessage *msg = gst_message_new_async_done (GST_OBJECT_CAST (self),
GST_CLOCK_TIME_NONE);
......@@ -108,6 +111,7 @@ do_async_done (GstSubtitleOverlay * self)
GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (self), msg);
self->do_async = FALSE;
}
GST_STATE_UNLOCK (self);
}
static GstPadProbeReturn
......
......@@ -884,10 +884,12 @@ do_async_start (GstURIDecodeBin * dbin)
{
GstMessage *message;
GST_STATE_LOCK (dbin);
dbin->async_pending = TRUE;
message = gst_message_new_async_start (GST_OBJECT_CAST (dbin));
GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (dbin), message);
GST_STATE_UNLOCK (dbin);
}
static void
......@@ -895,6 +897,7 @@ do_async_done (GstURIDecodeBin * dbin)
{
GstMessage *message;
GST_STATE_LOCK (dbin);
if (dbin->async_pending) {
GST_DEBUG_OBJECT (dbin, "posting ASYNC_DONE");
message =
......@@ -904,6 +907,7 @@ do_async_done (GstURIDecodeBin * dbin)
dbin->async_pending = FALSE;
}
GST_STATE_UNLOCK (dbin);
}
#define DEFAULT_QUEUE_SIZE (3 * GST_SECOND)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment