[FFmpeg-devel] [PATCH] lavf/utils: reset event_flags if extradata is not extracted correctly

Linjie Fu linjie.justin.fu at gmail.com
Sun Jan 24 17:05:56 EET 2021


Regression since 87f0c8280.

If the extradata of a stream could not be extracted correctly,
codec_info_nb_frames would remain zero, while st->event_flag would still
be marked as AVSTREAM_EVENT_FLAG_NEW_PACKETS.

The two expressions could be different in this case, hence reset
event_flags and calculate the correct score.

Fix #9029.

Signed-off-by: Linjie Fu <linjie.justin.fu at gmail.com>
---
 libavformat/utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 6f100294a1..de397a209e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3895,8 +3895,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
         }
         if (!st->internal->avctx->extradata) {
             ret = extract_extradata(st, pkt);
-            if (ret < 0)
+            if (ret < 0) {
+                st->event_flags = 0;
                 goto unref_then_goto_end;
+            }
         }
 
         /* If still no information, we try to open the codec and to
-- 
2.25.1



More information about the ffmpeg-devel mailing list