It is e.g. legal for an ISOBMFF avcc to contain zero parameter sets.
In this case the annex B that we produce would be empty and therefore
useless. This happens e.g. with mov/frag_overlap.mp4 from the
FATE-suite.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>
---
Maybe check for the number of units to write instead?

 libavcodec/cbs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 07ae658a4c..8d6e3c3442 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -438,6 +438,10 @@ int ff_cbs_write_extradata(CodedBitstreamContext *ctx,
         return err;
 
     av_freep(&par->extradata);
+    par->extradata_size = 0;
+
+    if (!frag->data_size)
+        return 0;
 
     par->extradata = av_malloc(frag->data_size +
                                AV_INPUT_BUFFER_PADDING_SIZE);
-- 
2.34.1

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

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

Reply via email to