mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
rtspsrc: Do more checks for seekability
When receiving a seek event, check whether we can actually seek based on the information the server provided. Also add more documentation on what the seekable field means
This commit is contained in:
parent
a260eb80fb
commit
10bc8fdfd2
2 changed files with 24 additions and 2 deletions
|
@ -2282,7 +2282,7 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
|
||||||
const gchar *seek_style = NULL;
|
const gchar *seek_style = NULL;
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
GST_DEBUG_OBJECT (src, "doing seek with event");
|
GST_DEBUG_OBJECT (src, "doing seek with event %" GST_PTR_FORMAT, event);
|
||||||
|
|
||||||
gst_event_parse_seek (event, &rate, &format, &flags,
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
||||||
&cur_type, &cur, &stop_type, &stop);
|
&cur_type, &cur, &stop_type, &stop);
|
||||||
|
@ -2294,6 +2294,14 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
|
||||||
/* we need TIME format */
|
/* we need TIME format */
|
||||||
if (format != src->segment.format)
|
if (format != src->segment.format)
|
||||||
goto no_format;
|
goto no_format;
|
||||||
|
|
||||||
|
/* Check if we are not at all seekable */
|
||||||
|
if (src->seekable == -1.0)
|
||||||
|
goto not_seekable;
|
||||||
|
|
||||||
|
/* Additional seeking-to-beginning-only check */
|
||||||
|
if (src->seekable == 0.0 && cur != 0)
|
||||||
|
goto not_seekable;
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (src, "doing seek without event");
|
GST_DEBUG_OBJECT (src, "doing seek without event");
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
@ -2425,6 +2433,11 @@ no_format:
|
||||||
GST_DEBUG_OBJECT (src, "unsupported format given, seek aborted.");
|
GST_DEBUG_OBJECT (src, "unsupported format given, seek aborted.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
not_seekable:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (src, "stream is not seekable");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -2622,6 +2635,8 @@ gst_rtspsrc_handle_src_query (GstPad * pad, GstObject * parent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (src, "seekable : %d", seekable);
|
||||||
|
|
||||||
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, start,
|
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable, start,
|
||||||
duration);
|
duration);
|
||||||
res = TRUE;
|
res = TRUE;
|
||||||
|
|
|
@ -270,7 +270,14 @@ struct _GstRTSPSrc {
|
||||||
/* supported methods */
|
/* supported methods */
|
||||||
gint methods;
|
gint methods;
|
||||||
|
|
||||||
/* Same semantic as described in gst_rtsp_media_seekable */
|
/* seekability
|
||||||
|
* -1.0 : Stream is not seekable
|
||||||
|
* 0.0 : seekable only to the beginning
|
||||||
|
* G_MAXFLOAT : Any value is possible
|
||||||
|
*
|
||||||
|
* Any other positive value indicates the longest duration
|
||||||
|
* between any two random access points
|
||||||
|
* */
|
||||||
gfloat seekable;
|
gfloat seekable;
|
||||||
GstClockTime last_pos;
|
GstClockTime last_pos;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue