From 21c6da6764c0cd015e9f3c5eecba36e297187deb Mon Sep 17 00:00:00 2001 From: Stavros Vagionitis Date: Wed, 14 Oct 2015 10:43:19 +0300 Subject: [PATCH] souphttpsrc: Make non-inclusive segment boundaries inclusive The problem is that the filesrc and souphttpsrc are behaving differently regarding the calculation of the segment boundaries. The filesrc is using a non-inclusive boundaries, while the souphttpsrc uses inclusive. Currently the hlsdemux calculates the boundaries as inclusive, so for this reason there is no problem with the souphttpsrc, but there is an issue in the filesrc. The GstSegment is non-inclusive, so the proposed solution is to use non-inclusive boundaries in the hlsdemux in order to be consistent. Make the change in the hlsdemux, will break the souphttpsrc, which will expect inclusive boundaries, but the hlsdemux will offer non-inclusive. This change makes sure that the non-inclusive boundaries are converted to inclusive. https://bugzilla.gnome.org/show_bug.cgi?id=748316 --- ext/soup/gstsouphttpsrc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index d9ae2e781a..302c42da15 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -797,8 +797,10 @@ gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src, guint64 offset, soup_message_headers_remove (src->msg->request_headers, "Range"); if (offset || stop_offset != -1) { if (stop_offset != -1) { + /* FIXME: If stop_offset == 0, this will still download a single byte */ rc = g_snprintf (buf, sizeof (buf), "bytes=%" G_GUINT64_FORMAT "-%" - G_GUINT64_FORMAT, offset, stop_offset); + G_GUINT64_FORMAT, offset, (stop_offset > 0) ? stop_offset - 1 : + stop_offset); } else { rc = g_snprintf (buf, sizeof (buf), "bytes=%" G_GUINT64_FORMAT "-", offset);