mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
souphttpsrc: Don't send seeks behind the end of file to the server
Also improve debug output, re-initialize the content size and let the seek handler error out on invalid seek segments. Fixes bug #632977.
This commit is contained in:
parent
005e27fa79
commit
6a93725292
1 changed files with 21 additions and 3 deletions
|
@ -320,6 +320,7 @@ gst_soup_http_src_reset (GstSoupHTTPSrc * src)
|
|||
src->seekable = FALSE;
|
||||
src->read_position = 0;
|
||||
src->request_position = 0;
|
||||
src->content_size = 0;
|
||||
|
||||
gst_caps_replace (&src->src_caps, NULL);
|
||||
g_free (src->iradio_name);
|
||||
|
@ -1175,7 +1176,11 @@ gst_soup_http_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
|
|||
src = GST_SOUP_HTTP_SRC (psrc);
|
||||
|
||||
if (src->msg && (src->request_position != src->read_position)) {
|
||||
if (src->session_io_status == GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE) {
|
||||
if (src->content_size != 0 && src->request_position >= src->content_size) {
|
||||
GST_WARNING_OBJECT (src, "Seeking behind the end of file -- EOS");
|
||||
return GST_FLOW_UNEXPECTED;
|
||||
} else if (src->session_io_status ==
|
||||
GST_SOUP_HTTP_SRC_SESSION_IO_STATUS_IDLE) {
|
||||
gst_soup_http_src_add_range_header (src, src->request_position);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (src, "Seek from position %" G_GUINT64_FORMAT
|
||||
|
@ -1365,11 +1370,24 @@ gst_soup_http_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
|
|||
|
||||
GST_DEBUG_OBJECT (src, "do_seek(%" G_GUINT64_FORMAT ")", segment->start);
|
||||
|
||||
if (src->read_position == segment->start)
|
||||
if (src->read_position == segment->start) {
|
||||
GST_DEBUG_OBJECT (src, "Seeking to current read position");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!src->seekable)
|
||||
if (!src->seekable) {
|
||||
GST_WARNING_OBJECT (src, "Not seekable");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (segment->rate != 1.0 || segment->format != GST_FORMAT_BYTES) {
|
||||
GST_WARNING_OBJECT (src, "Invalid seek segment");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (src->content_size != 0 && segment->start >= src->content_size) {
|
||||
GST_WARNING_OBJECT (src, "Seeking behind end of file, will go to EOS soon");
|
||||
}
|
||||
|
||||
/* Wait for create() to handle the jump in offset. */
|
||||
src->request_position = segment->start;
|
||||
|
|
Loading…
Reference in a new issue