aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/bufferqueue.h
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2013-01-31 14:24:08 +0100
committerNicolas George <nicolas.george@normalesup.org>2013-01-31 21:03:54 +0100
commit6560625f0aeca470ac936542fcc24ed2da8eff5e (patch)
tree27d40d43070a4fc7ffc502f3fe7541666126363e /libavfilter/bufferqueue.h
parentdd87d4a318b36cd246ca2fc40e74565f4bf2abfd (diff)
downloadffmpeg-6560625f0aeca470ac936542fcc24ed2da8eff5e.tar.gz
lavfi/bufferqueue: add ff_bufqueue_is_full().
Diffstat (limited to 'libavfilter/bufferqueue.h')
-rw-r--r--libavfilter/bufferqueue.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavfilter/bufferqueue.h b/libavfilter/bufferqueue.h
index a27fb86112..34c4c0f08b 100644
--- a/libavfilter/bufferqueue.h
+++ b/libavfilter/bufferqueue.h
@@ -55,6 +55,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.
*
* If the queue is already full, then the current last buffer is dropped
@@ -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));
}