Unified · Split
| @@ -54,6 +54,14 @@ struct FFBufQueue { · 53 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | #define BUCKET(i) queue->queue[(queue->head + (i)) % FF_BUFQUEUE_SIZE] |
| 56 | 56 | |
| 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 | + | |
| 57 | 65 | /** |
| 58 | 66 | * Add a buffer to the queue. |
| 59 | 67 | * |
| @@ -63,7 +71,7 @@ struct FFBufQueue { · 3 unmodified lines | ||
| 63 | 71 | static inline void ff_bufqueue_add(void *log, struct FFBufQueue *queue, |
| 64 | 72 | AVFilterBufferRef *buf) |
| 65 | 73 | { |
| 66 | − if (queue->available == FF_BUFQUEUE_SIZE) { | |
| 74 | + if (ff_bufqueue_is_full(queue)) { | |
| 67 | 75 | av_log(log, AV_LOG_WARNING, "Buffer queue overflow, dropping.\n"); |
| 68 | 76 | avfilter_unref_buffer(BUCKET(--queue->available)); |
| 69 | 77 | } |