... | ... |
@@ -55,6 +55,14 @@ struct FFBufQueue { |
55 | 55 |
#define BUCKET(i) queue->queue[(queue->head + (i)) % FF_BUFQUEUE_SIZE] |
56 | 56 |
|
57 | 57 |
/** |
58 |
+ * Test if a buffer queue is full. |
|
59 |
+ */ |
|
60 |
+static inline int ff_bufqueue_is_full(struct FFBufQueue *queue) |
|
61 |
+{ |
|
62 |
+ return queue->available == FF_BUFQUEUE_SIZE; |
|
63 |
+} |
|
64 |
+ |
|
65 |
+/** |
|
58 | 66 |
* Add a buffer to the queue. |
59 | 67 |
* |
60 | 68 |
* If the queue is already full, then the current last buffer is dropped |
... | ... |
@@ -63,7 +71,7 @@ struct FFBufQueue { |
63 | 63 |
static inline void ff_bufqueue_add(void *log, struct FFBufQueue *queue, |
64 | 64 |
AVFilterBufferRef *buf) |
65 | 65 |
{ |
66 |
- if (queue->available == FF_BUFQUEUE_SIZE) { |
|
66 |
+ if (ff_bufqueue_is_full(queue)) { |
|
67 | 67 |
av_log(log, AV_LOG_WARNING, "Buffer queue overflow, dropping.\n"); |
68 | 68 |
avfilter_unref_buffer(BUCKET(--queue->available)); |
69 | 69 |
} |