PR #22604 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22604
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22604.patch


>From 5c0c2ffcff82e8c46682cb9b25a0bac32e237b4f Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Tue, 24 Mar 2026 17:47:56 +0100
Subject: [PATCH 1/4] avfilter/framepool: Remove impossible branches

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavfilter/framepool.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 10a9b6cf27..01ff89d7ce 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -74,7 +74,6 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(size_t size),
         goto fail;
     }
 
-    if (!pool->linesize[0]) {
         ret = av_image_fill_linesizes(pool->linesize, pool->format,
                                       FFALIGN(pool->width, align));
         if (ret < 0) {
@@ -86,7 +85,6 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(size_t size),
             if ((pool->linesize[i] & (pool->align - 1)))
                 goto fail;
         }
-    }
 
     for (i = 0; i < 4; i++)
         linesizes[i] = pool->linesize[i];
@@ -284,7 +282,7 @@ void ff_frame_pool_uninit(FFFramePool **pool)
 {
     int i;
 
-    if (!pool || !*pool)
+    if (!*pool)
         return;
 
     for (i = 0; i < 4; i++) {
-- 
2.52.0


>From fdfcf29f609f204ae2c5f89a953f42c037fd90eb Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Tue, 24 Mar 2026 17:50:36 +0100
Subject: [PATCH 2/4] avfilter/framepool: Use av_unreachable() for unreachable
 code

Instead of av_assert0(0).

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavfilter/framepool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 01ff89d7ce..91101006df 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -269,7 +269,7 @@ AVFrame *ff_frame_pool_get(FFFramePool *pool)
 
         break;
     default:
-        av_assert0(0);
+        av_unreachable("only audio and video frame pools exist");
     }
 
     return frame;
-- 
2.52.0


>From f6ebb4daf3a6e3b414a958315b24b775d20d84f4 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Tue, 24 Mar 2026 17:55:23 +0100
Subject: [PATCH 3/4] avfilter/framepool: Reindent after the previous commit

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavfilter/framepool.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 91101006df..85759c9fb3 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -74,17 +74,17 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef* 
(*alloc)(size_t size),
         goto fail;
     }
 
-        ret = av_image_fill_linesizes(pool->linesize, pool->format,
-                                      FFALIGN(pool->width, align));
-        if (ret < 0) {
-            goto fail;
-        }
+    ret = av_image_fill_linesizes(pool->linesize, pool->format,
+                                    FFALIGN(pool->width, align));
+    if (ret < 0) {
+        goto fail;
+    }
 
-        for (i = 0; i < 4 && pool->linesize[i]; i++) {
-            pool->linesize[i] = FFALIGN(pool->linesize[i], pool->align);
-            if ((pool->linesize[i] & (pool->align - 1)))
-                goto fail;
-        }
+    for (i = 0; i < 4 && pool->linesize[i]; i++) {
+        pool->linesize[i] = FFALIGN(pool->linesize[i], pool->align);
+        if ((pool->linesize[i] & (pool->align - 1)))
+            goto fail;
+    }
 
     for (i = 0; i < 4; i++)
         linesizes[i] = pool->linesize[i];
-- 
2.52.0


>From 8b7048bf46ad27bd5157e75190f8d280971d74a6 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <[email protected]>
Date: Tue, 24 Mar 2026 17:58:58 +0100
Subject: [PATCH 4/4] avfilter/framepool: Mark init, uninit functions as
 av_cold

Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavfilter/framepool.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
index 85759c9fb3..0259415620 100644
--- a/libavfilter/framepool.c
+++ b/libavfilter/framepool.c
@@ -49,11 +49,10 @@ struct FFFramePool {
 
 };
 
-FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t size),
-                                      int width,
-                                      int height,
-                                      enum AVPixelFormat format,
-                                      int align)
+av_cold FFFramePool *ff_frame_pool_video_init(AVBufferRef* (*alloc)(size_t 
size),
+                                              int width, int height,
+                                              enum AVPixelFormat format,
+                                              int align)
 {
     int i, ret;
     FFFramePool *pool;
@@ -110,11 +109,10 @@ fail:
     return NULL;
 }
 
-FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t size),
-                                      int channels,
-                                      int nb_samples,
-                                      enum AVSampleFormat format,
-                                      int align)
+av_cold FFFramePool *ff_frame_pool_audio_init(AVBufferRef* (*alloc)(size_t 
size),
+                                              int channels, int nb_samples,
+                                              enum AVSampleFormat format,
+                                              int align)
 {
     int ret, planar;
     FFFramePool *pool;
@@ -278,7 +276,7 @@ fail:
     return NULL;
 }
 
-void ff_frame_pool_uninit(FFFramePool **pool)
+av_cold void ff_frame_pool_uninit(FFFramePool **pool)
 {
     int i;
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to