From ddb0d83844d0fe6c3c53c1d64bab7add948db0f7 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Thu, 22 Feb 2018 20:17:33 +0100 Subject: [PATCH] rtsp-media: fix RECORD getting stuck The test_record case was working because async=false had been added in https://bugzilla.gnome.org/show_bug.cgi?id=757488 but that was incorrect, as it should not be needed. Removing async=false made the test fail as expected, this is fixed by not trying to preroll when preparing the media for RECORD, as start_prepare is called upon receiving ANNOUNCE, and our peer will not start sending media until it has received a response to that request, and sent and received a response to RECORD as well, thus obviously preventing preroll. https://bugzilla.gnome.org/show_bug.cgi?id=793738 --- gst/rtsp-server/rtsp-media.c | 8 +++++++- tests/check/gst/rtspclientsink.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index 193f5e05b7..8f21fa9b31 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -3058,8 +3058,14 @@ start_prepare (GstRTSPMedia * media) g_object_set_data (G_OBJECT (elem), "gst-rtsp-dynpay-handlers", handlers); } - if (!start_preroll (media)) + if (priv->nb_dynamic_elements == 0 && is_receive_only (media)) { + /* If we are receive_only (RECORD), do not try to preroll, to avoid + * a second ASYNC state change failing */ + priv->is_live = TRUE; + gst_rtsp_media_set_status (media, GST_RTSP_MEDIA_STATUS_PREPARED); + } else if (!start_preroll (media)) { goto preroll_failed; + } g_rec_mutex_unlock (&priv->state_lock); diff --git a/tests/check/gst/rtspclientsink.c b/tests/check/gst/rtspclientsink.c index da2f2dd8d0..ddafdbae80 100644 --- a/tests/check/gst/rtspclientsink.c +++ b/tests/check/gst/rtspclientsink.c @@ -157,7 +157,7 @@ GST_START_TEST (test_record) mfactory = start_record_server - ("( rtppcmadepay name=depay0 ! appsink name=sink async=false )"); + ("( rtppcmadepay name=depay0 ! appsink name=sink )"); g_signal_connect (mfactory, "media-constructed", G_CALLBACK (media_constructed_cb), &server_sink);