summaryrefslogtreecommitdiff
path: root/libavcodec/cbs.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-20 14:37:38 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-25 14:53:49 +0200
commita7e54196cc94a71c44dd0bd4b91641740a7caf20 (patch)
tree013617ab21c02dbe0711c5f08f8bf219921b3279 /libavcodec/cbs.c
parent7ae1c0dd3ef8038f541716eb283380fd196041ad (diff)
downloadffmpeg-a7e54196cc94a71c44dd0bd4b91641740a7caf20.tar.gz
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>
Diffstat (limited to 'libavcodec/cbs.c')
-rw-r--r--libavcodec/cbs.c4
1 files changed, 4 insertions, 0 deletions
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);