diff mbox series

[FFmpeg-devel,05/36] avcodec/vp9_superframe_bsf: Allow up to eight frames in a superframe

Message ID 20200530160541.29517-5-andreas.rheinhardt@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/36] avcodec/vp9_superframe_bsf: Check for existence of data before reading it | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 30, 2020, 4:05 p.m. UTC
Up until now, the bsf errored out with a message that there were too
many invisible frames if there were already seven frames cached even
when the new frame was not invisible. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/vp9_superframe_bsf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c
index a8b58a7fd3..a7faad3abf 100644
--- a/libavcodec/vp9_superframe_bsf.c
+++ b/libavcodec/vp9_superframe_bsf.c
@@ -158,13 +158,15 @@  static int vp9_superframe_filter(AVBSFContext *ctx, AVPacket *pkt)
     } else if ((!invisible || uses_superframe_syntax) && !s->n_cache) {
         // passthrough
         return 0;
-    } else if (s->n_cache + 1 >= MAX_CACHE) {
+    } else if (invisible && s->n_cache + 1 >= MAX_CACHE) {
         av_log(ctx, AV_LOG_ERROR,
                "Too many invisible frames\n");
         res = AVERROR_INVALIDDATA;
         goto done;
     }
 
+    av_assert0(s->n_cache < MAX_CACHE);
+
     av_packet_move_ref(s->cache[s->n_cache++], pkt);
 
     if (invisible) {