summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2020-08-25 16:10:36 +0200
committerTim-Philipp Müller <tim@centricular.com>2020-09-30 01:24:36 +0100
commit018c1aed16fc3c87f42f75916a5e37c19d403aa8 (patch)
tree9867434b7358de6b0e8707f9df8e46fa95d62b8a
parent655c78ffa223e28d359873c2e0a2e0e658b82bd9 (diff)
rtsp-media: do not unblock on unsuspend
rtsp_media_unsuspend() is called from handle_play_request() before sending the play response. Unblocking the streams here was causing data to be sent out before the client was ready to handle it, with obvious side effects such as initial packets getting discarded, causing decoding errors. Instead we can simply let the media streams be unblocked when the state of the media is set to PLAYING, which occurs after sending the play response. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/156>
-rw-r--r--gst/rtsp-server/rtsp-media.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c
index e42cbb2..b8bc97b 100644
--- a/gst/rtsp-server/rtsp-media.c
+++ b/gst/rtsp-server/rtsp-media.c
@@ -4582,21 +4582,14 @@ default_unsuspend (GstRTSPMedia * media)
if (gst_rtsp_media_is_receive_only (media))
break;
if (media_streams_blocking (media)) {
- gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARING);
- /* at this point the media pipeline has been updated and contain all
- * specific transport parts: all active streams contain at least one sink
- * element and it's safe to unblock all blocked streams */
- media_streams_set_blocked (media, FALSE);
- } else {
- /* streams are not blocked and media is suspended from PAUSED */
- gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED);
- }
- g_rec_mutex_unlock (&priv->state_lock);
- if (gst_rtsp_media_get_status (media) == GST_RTSP_MEDIA_STATUS_ERROR) {
+ g_rec_mutex_unlock (&priv->state_lock);
+ if (gst_rtsp_media_get_status (media) == GST_RTSP_MEDIA_STATUS_ERROR) {
+ g_rec_mutex_lock (&priv->state_lock);
+ goto preroll_failed;
+ }
g_rec_mutex_lock (&priv->state_lock);
- goto preroll_failed;
}
- g_rec_mutex_lock (&priv->state_lock);
+ gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED);
break;
case GST_RTSP_SUSPEND_MODE_PAUSE:
gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED);