[Bug 748316] hlsdemux: The end offset (range_end) of a segment is not calculated properly in the m3u8 parser
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Mon Apr 27 08:48:18 PDT 2015
https://bugzilla.gnome.org/show_bug.cgi?id=748316
--- Comment #21 from Stavros <stavrosv at digisoft.tv> ---
Let me put some scenarios and how I think it myself. The scenarios are the
following
- segment.stop = -1, non-inclusive range [0,-1). If there is no `if`
statement, the stop = -2, which is an invalid value, so for this reason I leave
it as a -1. So, stop = -1.
- segment.stop = 0, non-inclusive range [0,0). As it is now, the stop = -1, is
an invalid value. I believe that we need to leave as it is, because if we
consider that segment.stop non-inclusive, then the [0,0) is invalid. So, stop =
-1.
- segment.stop = 1, non-inclusive range [0,1). The stop = 0 and we have valid
values. So, stop = 0.
(In reply to Thiago Sousa Santos from comment #20)
>
> Perhaps we want to keep segment_stop as non-inclusive and just subtract one
> when adding to the request headers?
If I understand correctly, the gist of what you are saying is the following
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c
index ad87223..ced1117 100644
--- a/ext/soup/gstsouphttpsrc.c
+++ b/ext/soup/gstsouphttpsrc.c
@@ -742,11 +742,13 @@ gst_soup_http_src_add_range_header (GstSoupHTTPSrc * src,
guint64 offset,
gint rc;
+ guint64 stop = stop_offset - 1 < 0 ? -1 : stop_offset - 1;
+
soup_message_headers_remove (src->msg->request_headers, "Range");
- if (offset || stop_offset != -1) {
- if (stop_offset != -1) {
+ if (offset || stop != -1) {
+ if (stop != -1) {
rc = g_snprintf (buf, sizeof (buf), "bytes=%" G_GUINT64_FORMAT "-%"
- G_GUINT64_FORMAT, offset, stop_offset);
+ G_GUINT64_FORMAT, offset, stop);
} else {
rc = g_snprintf (buf, sizeof (buf), "bytes=%" G_GUINT64_FORMAT "-",
offset);
If that's the case then I believe that the problem just moves from one place to
another. If the stop_offset = -1, again the stop = -2, so we need to change
this and for this reason I have used the condition that if it's negative, than
the value will be -1.
I am not really sure what is the best/clean approach. Personally speaking I
would consider the first approach :). Maybe it would be beneficial to add a
comment there with the above edge cases.
Anyone else to comment about this?
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list