[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
Wed Apr 22 14:49:48 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=748316

--- Comment #5 from Stavros <stavrosv at digisoft.tv> ---
This problems appears when the HLS playlist and the video file are located on
the local pc, and they are not served by a http server. I haven't tested that
scenario (http server), so I cannot say if there is a problem there.

At first I thought, like yourself(@slomo, @thiago), that the calculation is
correct and the problem is not there. But later, when I started to think more
on file context and not on http context, it made more sense to remove the -1.
If you have a file and you want to get a size_segment bytes segment from offset
start_offset, I believe that the end_offset would be start_offset+size_segment.

I had consider some other solutions for this issue, which are related to the
gst_base_src_update_length function in the libs/gst/base/gstbasesrc.c file. The
first is to increase the local stop variable by 1. This is because the stop
variable is used to calculate maxsize which is not correct. Next following a
patch for this change

--- a/libs/gst/base/gstbasesrc.c
+++ b/libs/gst/base/gstbasesrc.c
@@ -2338,7 +2338,7 @@ gst_base_src_update_length (GstBaseSrc * src, guint64
offset, guint * length,

   bclass = GST_BASE_SRC_GET_CLASS (src);

-  stop = src->segment.stop;
+  stop = src->segment.stop + 1;
   /* get total file size */
   size = src->segment.duration;

The other solution is to increase the length of the last buffer by 1. Next
following a patch for this change

--- a/libs/gst/base/gstbasesrc.c
+++ b/libs/gst/base/gstbasesrc.c
@@ -2381,7 +2381,7 @@ gst_base_src_update_length (GstBaseSrc * src, guint64
offset, guint * length,

       /* else we can clip to the end */
       if (G_UNLIKELY (offset + *length >= maxsize))
-        *length = maxsize - offset;
+        *length = maxsize - offset + 1;

     }
   }

I am not really sure about the last two proposed solutions because I am not so
familiar with gstreamer and basesrc seems a module that can be used by a number
of other modules.

-- 
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