[Bug 748316] New: 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 10:24:15 PDT 2015


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

            Bug ID: 748316
           Summary: hlsdemux The end offset (range_end) of a segment is
                    not calculated properly in the m3u8 parser
    Classification: Platform
           Product: GStreamer
           Version: 1.4.5
                OS: Linux
            Status: NEW
          Severity: major
          Priority: Normal
         Component: gst-plugins-bad
          Assignee: gstreamer-bugs at lists.freedesktop.org
          Reporter: stavrosv at digisoft.tv
        QA Contact: gstreamer-bugs at lists.freedesktop.org
     GNOME version: ---

I have an HLS stream which is byte-range segmented (stream.ts). The number of
segments is 361. When I run the following command

gst-launch-1.0 filesrc location=index.m3u8 ! hlsdemux ! filesink
location=out_stream.ts

the stream out_stream.ts is not the same with the stream.ts. I would expect to
be the same. Checking the size, the out_stream.ts is 361 bytes less than the
original stream stream.ts. Further analysis between the out_stream.ts and
stream.ts using a binary diff tool (vbindiff) reveals that the size of the
segments are -1 byte. Next following a snapshot of the binary diff tool when a
new segment is changing. The new segment starts at the byte with value 47 at
the second line. You can see that in the out_stream.ts it is shifted to the
left by 1 byte

stream.ts
0021 8EA0: FF FF FF FF FF FF FF FF  C6 7A 43 BA 69 9E B0 A3  ........ .zC.i...  
0021 8EB0: CE BC 9E 75 51 18 35 10  47 40 00 11 00 00 B0 0D  ...uQ.5. G at ......  
0021 8EC0: 41 57 C1 00 00 41 57 E0  20 9D E6 30 91 FF FF FF  AW...AW.  ..0....  

out_stream.ts
0021 8EA0: FF FF FF FF FF FF FF FF  C6 7A 43 BA 69 9E B0 A3  ........ .zC.i...  
0021 8EB0: CE BC 9E 75 51 18 35 47  40 00 11 00 00 B0 0D 41  ...uQ.5G @......A  
0021 8EC0: 57 C1 00 00 41 57 E0 20  9D E6 30 91 FF FF FF FF  W...AW.  ..0.....  

So, looking closely at the parsing of the m3u8 file in the hlsdemux, I came
across the following snippet in the gst_m3u8_client_get_next_fragment function
in the m3u8.c file

  if (range_end)
    *range_end = file->size != -1 ? file->offset + file->size - 1 : -1;

This snippet calculates the end offset of the segment. If the size of the
segment has a value other than -1, then the end offset will be
start_offset+size_segment-1. I don't believe that this is correct, it should be 
start_offset+size_segment.

Removing the -1 I rerun the gst-launch-1.0 command and I got an identical file
with the original one.

Removing the -1 is the proper solution for this issue?

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