[FFmpeg-devel] [PATCH 1/3] lavfi/bufferqueue: add ff_bufqueue_is_full().

Stefano Sabatini stefasab at gmail.com
Thu Jan 31 17:40:07 CET 2013


On date Thursday 2013-01-31 14:39:07 +0100, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  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));
>      }

LGTM, thanks.
-- 
FFmpeg = Fiendish and Fierce Multipurpose Plastic Embarassing Geisha


More information about the ffmpeg-devel mailing list