Commit c18b609c authored by Sebastian Dröge's avatar Sebastian Dröge

rtspsrc: When seeking, consider the current element state or pending state...

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.
parent d6f597db
......@@ -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);
......
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