aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-05-25 22:20:39 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-05-25 22:20:39 +0000
commit0871ae1a930122f7124358a0ce3caf81876913a9 (patch)
tree8626d4af558891862dcd1ecc81cb1d949355eb3e /libavformat
parent46eab09341d3496ad680bb1bf609ea38c7deea66 (diff)
downloadffmpeg-0871ae1a930122f7124358a0ce3caf81876913a9.tar.gz
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. Originally committed as revision 13404 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegenc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 05c72cd1e7..c96ffd1684 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -913,8 +913,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
}
/* 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=