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>
pull/388/head
Andreas Rheinhardt 2 years ago
parent 7ae1c0dd3e
commit a7e54196cc
  1. 4
      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);

Loading…
Cancel
Save