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@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-09-20 14:37:38 +02:00
parent 7ae1c0dd3e
commit a7e54196cc
1 changed files with 4 additions and 0 deletions

View File

@ -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);