[FFmpeg-cvslog] lavfi/bufferqueue: add ff_bufqueue_is_full().

Nicolas George git at videolan.org
Thu Jan 31 21:15:40 CET 2013


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Thu Jan 31 14:24:08 2013 +0100| [6560625f0aeca470ac936542fcc24ed2da8eff5e] | committer: Nicolas George

lavfi/bufferqueue: add ff_bufqueue_is_full().

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6560625f0aeca470ac936542fcc24ed2da8eff5e
---

 libavfilter/bufferqueue.h |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavfilter/bufferqueue.h b/libavfilter/bufferqueue.h
index a27fb86..34c4c0f 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));
     }



More information about the ffmpeg-cvslog mailing list