[vlc-devel] [PATCH] stream_filter: prefetch: early fail on seek
Rémi Denis-Courmont
remi at remlab.net
Wed Jul 27 22:20:17 CEST 2016
Nothing says that seeking past the end should fail. This has already been
discussed, and e.g. stream_Memory allows it.
Besides this needlessly breaks streams with changing size. And that´s
definitely possible and sometimes requested for local files.
No thanks.
Le keskiviikkona 27. heinäkuuta 2016, 19.54.29 EEST Francois Cartegnie a
écrit :
> ---
> modules/stream_filter/prefetch.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/modules/stream_filter/prefetch.c
> b/modules/stream_filter/prefetch.c index 38d7937..3280810 100644
> --- a/modules/stream_filter/prefetch.c
> +++ b/modules/stream_filter/prefetch.c
> @@ -255,15 +255,20 @@ static void *Thread(void *data)
> static int Seek(stream_t *stream, uint64_t offset)
> {
> stream_sys_t *sys = stream->p_sys;
> + int i_ret = 0;
>
> vlc_mutex_lock(&sys->lock);
> - if (sys->stream_offset != offset)
> + if(sys->size != (uint64_t)-1 && offset >= sys->size)
> + {
> + i_ret = -1;
> + }
> + else if (sys->stream_offset != offset)
> {
> sys->stream_offset = offset;
> vlc_cond_signal(&sys->wait_space);
> }
> vlc_mutex_unlock(&sys->lock);
> - return 0;
> + return i_ret;
> }
>
> static size_t BufferLevel(const stream_t *stream, bool *eof)
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list