[FFmpeg-devel] [PATCH v2 1/2] avcodec/vvcdec: we need error handling if fc->ft is NULL

Nuo Mi nuomi2021 at gmail.com
Thu Apr 25 17:01:35 EEST 2024


Another inter frame may be waiting on this frame.
We must finish it to avoid infinite waiting.
---
 libavcodec/vvc/dec.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index 6aeec27eaf..92999a3ce3 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -854,6 +854,13 @@ static int decode_nal_units(VVCContext *s, VVCFrameContext *fc, AVPacket *avpkt)
             }
         }
     }
+
+    if (!fc->ft) {
+        av_log(s->avctx, AV_LOG_ERROR, "No frame in the packet.\n");
+        ret = AVERROR_INVALIDDATA;
+        goto fail;
+    }
+
     return 0;
 
 fail:
@@ -948,9 +955,6 @@ static int vvc_decode_frame(AVCodecContext *avctx, AVFrame *output,
     if (ret < 0)
         return ret;
 
-    if (!fc->ft)
-        return avpkt->size;
-
     ret = submit_frame(s, fc, output, got_output);
     if (ret < 0)
         return ret;
-- 
2.34.1



More information about the ffmpeg-devel mailing list