From: Sebastian Dröge Date: Tue, 28 Jun 2016 07:57:27 +0000 (+0300) Subject: rtspsrc: When seeking, consider the current element state or pending state instead... X-Git-Tag: 1.10.4~305 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c18b609c06e39207c09a82ea675d6bdd358ecf40;p=platform%2Fupstream%2Fgst-plugins-good.git rtspsrc: When seeking, consider the current element state or pending state instead of the RTSP state If we consider the RTSP state, what can happen is that it is PLAYING but the element already asynchronously tried to PAUSE and it just did not happen yet. We would then override this setting to PAUSED (while the element actually is in PAUSED) and set the RTSP state to PLAYING again. This would then cause us to produce packets while the sinks are all PAUSED, piling up thousands of packets in the rtpjitterbuffer and other elements and finally failing. --- diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 3addf7a..662e0f1 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -2170,9 +2170,8 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event) if ((stop = seeksegment.stop) == -1) stop = seeksegment.duration; - playing = (src->state == GST_RTSP_STATE_PLAYING); - /* if we were playing, pause first */ + playing = (src->state == GST_RTSP_STATE_PLAYING); if (playing) { /* obtain current position in case seek fails */ gst_rtspsrc_get_position (src); @@ -2185,7 +2184,12 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event) /* PLAY will add the range header now. */ src->need_range = TRUE; - /* and continue playing */ + /* and continue playing if needed */ + GST_OBJECT_LOCK (src); + playing = (GST_STATE_PENDING (src) == GST_STATE_VOID_PENDING + && GST_STATE (src) == GST_STATE_PLAYING) + || (GST_STATE_PENDING (src) == GST_STATE_PLAYING); + GST_OBJECT_UNLOCK (src); if (playing) gst_rtspsrc_play (src, &seeksegment, FALSE);