Skip to content

Commit

Permalink
rtsp-media: update expected_async_done during suspend
Browse files Browse the repository at this point in the history
Set expected_async_done to FALSE in default_suspend() if a state change
occurs and the return value from set_target_state() is something other
than GST_STATE_CHANGE_ASYNC.

Without this change there is a risk that expected_async_done will be
TRUE even though no asynchronous state change is taking place. This
could happen if the pipeline is set to PAUSED using
media_set_pipeline_state_locked(), an asynchronous state change starts
and then the media is suspended (which could result in a state change,
aborting the asynchronous state change). If the media is suspended
before the asynchronous state change ends then expected_async_done will
be TRUE but no asynchronous state change is taking place.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/123>
  • Loading branch information
Ludvig Rappe authored and GStreamer Merge Bot committed May 27, 2020
1 parent ba7d568 commit 0526a5c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gst/rtsp-server/rtsp-media.c
Original file line number Diff line number Diff line change
Expand Up @@ -4444,7 +4444,7 @@ static gboolean
default_suspend (GstRTSPMedia * media)
{
GstRTSPMediaPrivate *priv = media->priv;
GstStateChangeReturn ret;
GstStateChangeReturn ret = GST_STATE_CHANGE_FAILURE;

switch (priv->suspend_mode) {
case GST_RTSP_SUSPEND_MODE_NONE:
Expand Down Expand Up @@ -4472,6 +4472,12 @@ default_suspend (GstRTSPMedia * media)
break;
}

/* If we use any suspend mode that changes the state then we must update
* expected_async_done, since we might not be doing an asyncronous state
* change anymore. */
if (ret != GST_STATE_CHANGE_FAILURE && ret != GST_STATE_CHANGE_ASYNC)
priv->expected_async_done = FALSE;

return TRUE;

/* ERRORS */
Expand Down

0 comments on commit 0526a5c

Please sign in to comment.