Subject: [PATCH] framequeue: Remove redundant logic code

From: yangyalei <[email-masked]>
Date: Thu, 14 Sep 2023 21:09:17 +0800

In this logical branch, fq->queued and fq->allocated must be equal.
Deleting this code will make it easier to understand the logic (
copy the data before tail to the newly requested space)

Signed-off-by: yangyalei <[email-masked]>
---
 libavfilter/framequeue.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavfilter/framequeue.c b/libavfilter/framequeue.c
index 383c195b85..ace0dad689 100644
--- a/libavfilter/framequeue.c
+++ b/libavfilter/framequeue.c
@@ -79,9 +79,8 @@ int ff_framequeue_add(FFFrameQueue *fq, AVFrame *frame)
             FFFrameBucket *nq = av_realloc_array(fq->queue, na, sizeof(*nq));
             if (!nq)
                 return AVERROR(ENOMEM);
-            if (fq->tail + fq->queued > fq->allocated)
-                memmove(nq + fq->allocated, nq,
-                        (fq->tail + fq->queued - fq->allocated) * sizeof(*nq));
+            if (fq->tail)
+                memmove(nq + fq->allocated, nq, fq->tail * sizeof(*nq));
             fq->queue = nq;
             fq->allocated = na;
         }
-- 
2.41.0