hlsdemux: using iframe playlists when seeking

Sebastian Dröge sebastian at centricular.com
Fri Dec 5 00:30:15 PST 2014

On Fr, 2014-12-05 at 15:55 +1000, Duncan Palmer wrote:
> Hi,
> I'm finding that seek performance with hlsdemux is poor when seeking
> to a time near the end of a segment. This is because the entire
> segment is pushed through the pipeline - most of it is not decoded,
> but with HD streams, the volume of data is high enough that it takes 2
> or 3 seconds for data at the correct offset to arrive at the decoders,
> if I seek to somewhere near the end of a 10 second segment.
> I'm looking at using iframe playlists in hlsdemux to enable it to seek
> to the correct offset within a segment. I think this can be
> implemented by
> Modifying gst_hls_demux_src_event() so that it does something like the
> following:
> - switch to the iframe playlist
> - determine the offset within the current segment corresponding to the
> seek position. Store this in demux->client->partial_range_start (new
> variable).
> - switch back to the regular playlist
> Modifying gst_m3u8_client_get_next_fragment() so that rather than
> using the offset it's just read from the m3u8 file, use
> demux->client->partial_range_start, just once.
> I've attached a patch which implements the core part of this idea (it
> compiles, but it untested, and undoubtedly has bugs and missing bits).
> Would anyone like to comment on this approach? Can you think of a
> neater way to do it?

While the idea is good, the problem is that this requires the I-frame
playlist to point to the I-frame offsets in the normal playlist. This is
not required by the spec, it can be a completely different MPEG TS

I think there's not much we can do better here. I guess in theory you
could estimate the byte offset inside the TS stream by looking at the
bitrate and underestimate it a bit but that's also not going to work

Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20141205/3021d111/attachment.sig>

More information about the gstreamer-devel mailing list