Mercurial > libavformat.hg
changeset 3343:201853ef633e libavformat
Make av_fifo*_read() ignore the available amount of data.
This is more efficient as in practice the check is redundant most of the
time. Callers which do not know if enough data is available have to check
it with av_fifo_size(). Doing the check in *read() means the caller has
no choice to skip the check when its known to be redundant.
Also the return value was never documented in a public header so
changing it should not break the API. Besides this fixes the case where
read() failed on a 100% full fifo.
author | michael |
---|---|
date | Sun, 25 May 2008 22:20:39 +0000 |
parents | a25db3f275d2 |
children | f5b6c915f991 |
files | mpegenc.c |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegenc.c Sun May 25 01:22:06 2008 +0000 +++ b/mpegenc.c Sun May 25 22:20:39 2008 +0000 @@ -913,8 +913,8 @@ } /* output data */ - if(av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, ctx->pb) < 0) - return -1; + assert(payload_size - stuffing_size <= av_fifo_size(&stream->fifo)); + av_fifo_generic_read(&stream->fifo, payload_size - stuffing_size, &put_buffer, ctx->pb); stream->bytes_to_iframe -= payload_size - stuffing_size; }else{ payload_size=