lavfi/bufferqueue: add ff_bufqueue_is_full().

This commit is contained in:
Nicolas George 2013-01-31 14:24:08 +01:00
parent dd87d4a318
commit 6560625f0a

View File

@ -54,6 +54,14 @@ struct FFBufQueue {
#define BUCKET(i) queue->queue[(queue->head + (i)) % FF_BUFQUEUE_SIZE]
/**
* Test if a buffer queue is full.
*/
static inline int ff_bufqueue_is_full(struct FFBufQueue *queue)
{
return queue->available == FF_BUFQUEUE_SIZE;
}
/**
* Add a buffer to the queue.
*
@ -63,7 +71,7 @@ struct FFBufQueue {
static inline void ff_bufqueue_add(void *log, struct FFBufQueue *queue,
AVFilterBufferRef *buf)
{
if (queue->available == FF_BUFQUEUE_SIZE) {
if (ff_bufqueue_is_full(queue)) {
av_log(log, AV_LOG_WARNING, "Buffer queue overflow, dropping.\n");
avfilter_unref_buffer(BUCKET(--queue->available));
}