[vlc-devel] [PATCH 02/11] demux: wav: refactor chunk skip

Thomas Guillem thomas at gllm.fr
Fri Mar 13 17:24:51 CET 2020



On Fri, Mar 13, 2020, at 17:08, Rémi Denis-Courmont wrote:
> Le perjantaina 13. maaliskuuta 2020, 17.53.06 EET Thomas Guillem a écrit :
> > Here is what I propose:
> > 
> > static int ChunkSkip( demux_t *p_demux, uint32_t i_size )
> > {
> >     i_size += i_size & 1;
> > 
> >     if( i_size >= 65536 )
> >         return vlc_stream_Seek( p_demux->s,
> >                                 vlc_stream_Tell( p_demux->s ) + i_size );
> > 
> >     ssize_t i_ret = vlc_stream_Read( p_demux->s, NULL, i_size );
> >     return i_ret < 0 || (size_t) i_ret != i_size ? VLC_EGENERIC :
> > VLC_SUCCESS; }
> 
> Off-by-one overflow if i_size is SIZE_MAX.

Indeed, I will use uadd_overflow().
Maybe I can add Seek_CUR helper. And then, later we can propagate to access modules.

> 
> And there's no point optimizing the seek away if you can't play non-seekable 
> inputs.

I'm not sure I understand you.

For 99% of wav samples, you won't need to seek.
Indeed, chunks are likely smaller than 65536 and the data chunk is very likely the last one (so not skipped).

> 
> -- 
> 雷米‧德尼-库尔蒙
> http://www.remlab.net/
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list