Commit 6560625f authored by Nicolas George's avatar Nicolas George

lavfi/bufferqueue: add ff_bufqueue_is_full().

parent dd87d4a3
......@@ -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));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment