[vlc-devel] [PATCH] HLS: Add flag to start from the beginning of a broadcast, even when in live mode
Chris Smowton
cs448 at cam.ac.uk
Thu May 31 18:46:05 CEST 2012
Damnit, that was the wrong version of the patch (I split it into the
proper one, attached, and the housekeeping patch I just sent).
C
> Hi,
>
> Here's the last patch in my list of HLS features I need, and which
> might be useful in general. This one is aimed at timeshifting
> scenarios: when a programme is being broadcast live, but nontheless a
> viewer arriving some minutes into the programme wants to start at the
> beginning, not the present moment. This matches with VLC's HLS output
> filter running with --keep-segments, which gradually assembles a VOD
> feed, which looks 'live' whilst the broadcast is in progress.
>
> I simply add a flag, --hls-start-beginning, which forces it to start
> at the first available segment regardless of whether the stream is
> live or not. Whilst I'm at it, I clean up ChooseSegment, since it did
> a bunch of pointless work for VOD streams before inevitably returning
> zero.
>
> The simplest form of this patch broke the download thread, however:
> this was because the DL thread was always greedy when running against
> a "live" stream, with potentially huge memory consumption for this
> kind of stream. It was probably that way because its wait condition
> was broken: it tried to wait for the playlist to get longer if
> appropriate, but it didn't re-check the list length, nor did the
> list-update thread signal it when the list changed. Instead it broke
> out of its wait loop and tried to download again whenever the playback
> pointer advanced.
>
> I fix this by correcting its wait condition: it now checks the
> playlist length under the correct lock, and uses a semaphore
> ("hls_download_t::check_stream") guarded by the download lock to learn
> when it should re-check the playlist length. The playlist update
> thread simply sets this flag whenever it refreshes the list (ideally
> this would be whenever it *changes*). In this way the download thread
> can obey its buffer cap of 6 segments even when dealing with live
> streams.
>
> Chris
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120531/067c2fbc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-HLS-Add-flag-hls-start-beginning-which-causes-us-to-.patch
Type: text/x-patch
Size: 7845 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120531/067c2fbc/attachment.bin>
More information about the vlc-devel
mailing list