[vlc-devel] [vlc-commits] hls: Don't download the same segment twice when prefetching.

Frederic YHUEL fyhuel at viotech.net
Tue Feb 7 12:27:15 CET 2012


On Fri, Feb 3, 2012 at 12:37 PM, Hugo Beauzée-Luyssen <git at videolan.org> wrote:
> vlc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Feb  2 16:24:59 2012 +0100| [1555e3ce33ff3a75c19fdae4af08d052aed734c8] | committer: Hugo Beauzée-Luyssen
>
> hls: Don't download the same segment twice when prefetching.
>
> This makes the playback start faster.
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1555e3ce33ff3a75c19fdae4af08d052aed734c8
> ---
>
>  modules/stream_filter/httplive.c |   22 ++++------------------
>  1 files changed, 4 insertions(+), 18 deletions(-)
>
> diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
> index f573404..79abe60 100644
> --- a/modules/stream_filter/httplive.c
> +++ b/modules/stream_filter/httplive.c
> @@ -1724,35 +1724,21 @@ static void* hls_Reload(void *p_this)
>  static int Prefetch(stream_t *s, int *current)
>  {
>     stream_sys_t *p_sys = s->p_sys;
> -    int stream;
> +    int stream = *current;
>
> -    /* Try to pick best matching stream */;
> -again:
> -    stream = *current;
> -
> -    hls_stream_t *hls = hls_Get(p_sys->hls_stream, *current);
> +    hls_stream_t *hls = hls_Get(p_sys->hls_stream, stream);
>     if (hls == NULL)
>         return VLC_EGENERIC;
>
> -    segment_t *segment = segment_GetSegment(hls, p_sys->download.segment);
> -    if (segment == NULL )
> -        return VLC_EGENERIC;
> -
> -    if (hls_DownloadSegmentData(s, hls, segment, current) != VLC_SUCCESS)
> -        return VLC_EGENERIC;
> -
> -    /* Found better bandwidth match, try again */
> -    if (*current != stream)
> -        goto again;
> -
>     /* Download first 2 segments of this HLS stream */
> -    stream = *current;
>     for (int i = 0; i < 2; i++)
>     {
>         segment_t *segment = segment_GetSegment(hls, p_sys->download.segment);
>         if (segment == NULL )
>             return VLC_EGENERIC;
>
> +        /* It is useless to lock the segment here, as Prefetch is called before
> +           download and playlit thread are started. */
>         if (segment->data)
>         {
>             p_sys->download.segment++;
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> http://mailman.videolan.org/listinfo/vlc-commits

Hello,

This commit seems to have introduced a bug or revealed a libav one:

If I don't revert it, I'm flooded with libavcodec errors:

[0x8457908] avcodec decoder warning: cannot decode one frame (30836 bytes)
[h264 @ 0x845df80] allocate_progress() overflow
[h264 @ 0x845df80] get_buffer() failed (-1 0 0 (nil))
[h264 @ 0x845df80] decode_slice_header error

But the sound is fine.

I did the test with the following m3u8:
http://qthttp.apple.com.edgesuite.net/11piubpwiqubf06c/sl_vod.m3u8

Best Regards,

-- 
Frédéric



More information about the vlc-devel mailing list