[vlc-devel] [PATCH 20/48] hls: Fix seeking

Jean-Paul Saman jpsaman at videolan.org
Tue Jan 10 15:11:56 CET 2012


NACK for this patch.

The download thread downloads the needed segments as requested by the
segment_Seek() fuction. Which in its turn waits for the download to be
finished before continuing playback.
If a changes in that logic must be done, then it should be done in the
download thread and not here.

Kind regards,

Jean-Paul Saman.

On Mon, Jan 9, 2012 at 4:16 PM, Hugo Beauzée-Luyssen <beauze.h at gmail.com> wrote:
> From: Luc Saillard <luc.saillard at sfr.com>
>
> ---
>  modules/stream_filter/httplive.c |   25 +++++++++++++++++++++++--
>  1 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
> index ff8bf33..5583393 100644
> --- a/modules/stream_filter/httplive.c
> +++ b/modules/stream_filter/httplive.c
> @@ -2507,20 +2507,41 @@ static int segment_Seek(stream_t *s, const uint64_t pos)
>
>         /* Wake up download thread */
>         vlc_mutex_lock(&p_sys->download.lock_wait);
> -        p_sys->download.seek = p_sys->playback.segment;
> +        int seek_to_segment = p_sys->download.seek = p_sys->playback.segment;
>         vlc_cond_signal(&p_sys->download.wait);
>         vlc_mutex_unlock(&p_sys->download.lock_wait);
>
>         /* Wait for download to be finished */
> +
>         vlc_mutex_lock(&p_sys->download.lock_wait);
>         msg_Info(s, "seek to segment %d", p_sys->playback.segment);
>         while (((p_sys->download.seek != -1) ||
>                 (p_sys->download.segment - p_sys->playback.segment < 3)) &&
>                 (p_sys->download.segment < (count - 6)))
>         {
> +             int i;
> +             /* Download like Prefetch(), 3 segments in advance */
> +             for (i = 0; i < 3; i++) {
> +                     segment_t *segment = segment_GetSegment(hls, seek_to_segment + i);
> +                     if (segment == NULL)
> +                             goto end;
> +                     vlc_mutex_lock(&segment->lock);
> +                     if (segment->data == NULL)
> +                     {
> +                             /* The data is not ready, break, to sleep a little */
> +                             vlc_mutex_unlock(&segment->lock);
> +                             break;
> +                     }
> +                     vlc_mutex_unlock(&segment->lock);
> +             }
> +             if (i == 3)
> +                     goto end;
> +
>             vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait);
> -            if (!vlc_object_alive(s) || s->b_error || p_sys->b_quit) break;
> +            if (!vlc_object_alive(s) || s->b_error || p_sys->b_quit)
> +                break;
>         }
> +end:
>         vlc_mutex_unlock(&p_sys->download.lock_wait);
>
>         return VLC_SUCCESS;
> --
> 1.7.8.3
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list