On Tue, Oct 13, 2015 at 06:30:46PM +0800, Zhang Rui wrote:
> ---
> libavutil/fifo.c | 37 +++++++++++++++++++++++++++++++++++++
> libavutil/fifo.h | 11 +++++++++++
> tests/ref/fate/fifo | 14 ++++++++++++++
> 3 files changed, 62 insertions(+)
>
> diff --git a/libavutil/fifo.c b/libavutil/fifo.c
> index 07fb4ec..cabb009 100644
> --- a/libavutil/fifo.c
> +++ b/libavutil/fifo.c
> @@ -148,6 +148,35 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src,
> int size,
> return total - size;
> }
>
> +int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int
> buf_size, void (*func)(void*, void*, int))
> +{
> + uint8_t *rptr = f->rptr + offset;
> + uint32_t rndx = f->rndx + offset;
> +
> + av_assert2(offset >= 0);
> + while (buf_size > 0) {
> + int len;
> +
> + if (rptr >= f->end)
> + rptr -= f->end - f->buffer;
> +> + av_assert2(rndx < f->wndx); *ndx are indexes modulo 2^32, they are intended to overflow so this condition will become false at some point around 4gb [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
