summaryrefslogtreecommitdiff
path: root/ext/soup
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-10-31 18:08:17 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-12-02 19:18:02 +0100
commit6a9372529222300c7b6eacfcf8b9a844b96021c9 (patch)
treea527dfd1cedd71a20422d62ef4afdae0c03c5fb5 /ext/soup
parent005e27fa79246869e0af373d223e85ee34c335cf (diff)
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.
Diffstat (limited to 'ext/soup')
-rw-r--r--ext/soup/gstsouphttpsrc.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index 9eb6bd2da..4d7798456 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -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) {
+ GST_WARNING_OBJECT (src, "Not seekable");
+ return FALSE;
+ }
- if (!src->seekable)
+ 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;