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

Fixes #20827.

Signed-off-by: Nicolas Gaullier <[email protected]>


>From 26ac8a2c0719c3cc60e9d965b6021a314e219e24 Mon Sep 17 00:00:00 2001
From: Nicolas Gaullier <[email protected]>
Date: Mon, 29 Dec 2025 18:51:01 +0100
Subject: [PATCH] avfilter/src_movie: fix support multiple frames per packet

Fixes #20827.

Signed-off-by: Nicolas Gaullier <[email protected]>
---
 libavfilter/src_movie.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index adb21e019e..ae2e74c1b6 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -519,7 +519,7 @@ static int decode_packet(AVFilterContext *ctx, int i)
     AVCodecContext *dec = movie->st[i].codec_ctx;
     AVFrame *frame = movie->st[i].frame;
     AVPacket *pkt = movie->pkt;
-    int ret = 0;
+    int ret = 0, has_frame = 0;
 
     // submit the packet to the decoder
     if (!movie->eof) {
@@ -529,15 +529,16 @@ static int decode_packet(AVFilterContext *ctx, int i)
     }
 
     // get all the available frames from the decoder
-    if (ret >= 0) {
+    while (ret >= 0) {
         ret = avcodec_receive_frame(dec, frame);
         if (ret < 0) {
             // those two return values are special and mean there is no output
             // frame available, but there were no errors during decoding
             if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN))
-                return 0;
+                return has_frame;
             return ret;
         }
+        has_frame |= 1;
 
         frame->pts = frame->best_effort_timestamp;
         if (frame->pts != AV_NOPTS_VALUE) {
@@ -558,8 +559,6 @@ static int decode_packet(AVFilterContext *ctx, int i)
         ret = ff_filter_frame(outlink, av_frame_clone(frame));
         if (ret < 0)
             return ret;
-        if (ret == 0)
-            return 1;
     }
 
     return 0;
-- 
2.49.1

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

Reply via email to