avutil/fifo: assert that theres enough data in the fifo on drain calls.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
3e36dc8626
commit
cc84f30402
@ -19,6 +19,8 @@
|
|||||||
* License along with FFmpeg; if not, write to the Free Software
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "avassert.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "fifo.h"
|
#include "fifo.h"
|
||||||
|
|
||||||
@ -144,6 +146,7 @@ int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size,
|
|||||||
/** Discard data from the FIFO. */
|
/** Discard data from the FIFO. */
|
||||||
void av_fifo_drain(AVFifoBuffer *f, int size)
|
void av_fifo_drain(AVFifoBuffer *f, int size)
|
||||||
{
|
{
|
||||||
|
av_assert2(av_fifo_size(f) >= size);
|
||||||
f->rptr += size;
|
f->rptr += size;
|
||||||
if (f->rptr >= f->end)
|
if (f->rptr >= f->end)
|
||||||
f->rptr -= f->end - f->buffer;
|
f->rptr -= f->end - f->buffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user