ffmpeg | branch: release/6.1 | Paul B Mahol <one...@gmail.com> | Fri Dec  1 
16:59:07 2023 +0100| [1606aab99bd84f0040fb0fa6ccccb092941f01ec] | committer: 
James Almer

avfilter/avfilter: fix OOM case for default activate

Fixes OOM when caller keeps adding frames into filtergraph
that reached EOF by other means, for example EOF is signalled
by other filter in filtergraph or by buffersink.

(cherry picked from commit d9e41ead82263e96ebd14d4d88d6e7f858dd944c)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1606aab99bd84f0040fb0fa6ccccb092941f01ec
---

 libavfilter/avfilter.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index ab7782862a..bde1c33d07 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1167,6 +1167,16 @@ static int ff_filter_activate_default(AVFilterContext 
*filter)
 {
     unsigned i;
 
+    for (i = 0; i < filter->nb_outputs; i++) {
+        int ret = filter->outputs[i]->status_in;
+
+        if (ret) {
+            for (int j = 0; j < filter->nb_inputs; j++)
+                ff_inlink_set_status(filter->inputs[j], ret);
+            return 0;
+        }
+    }
+
     for (i = 0; i < filter->nb_inputs; i++) {
         if (samples_ready(filter->inputs[i], filter->inputs[i]->min_samples)) {
             return ff_filter_frame_to_filter(filter->inputs[i]);

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to