[FFmpeg-cvslog] avcodec/cbs: Only write extradata if there is something to write
Andreas Rheinhardt
git at videolan.org
Sun Sep 25 15:58:29 EEST 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Sep 20 14:37:38 2022 +0200| [a7e54196cc94a71c44dd0bd4b91641740a7caf20] | committer: Andreas Rheinhardt
avcodec/cbs: Only write extradata if there is something to write
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.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7e54196cc94a71c44dd0bd4b91641740a7caf20
---
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);
More information about the ffmpeg-cvslog
mailing list