avformat/movenc: Add more error checking when writing sample entries.
authorNikolas Bowe <nbowe-at-google.com@ffmpeg.org>
Tue, 5 Feb 2019 01:02:19 +0000 (17:02 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 6 Feb 2019 23:29:01 +0000 (00:29 +0100)
commit2b8458fcc5d503d0587f14d1fe9107878691cbae
tree11822b7d3b2c662b7be834deef59f9e366c6ba8d
parent1aa796bc9c65580e0d369076add4d6017486fbd2
avformat/movenc: Add more error checking when writing sample entries.

Fixes a problem where a sample entry which cannot be written correctly appears to succeed, but produces an invalid file.
For example, this command:
ffmpeg -f lavfi -i sine=frequency=1000:duration=5 -codec:a ac3 -movflags +empty_moov -frag_duration 5000000 /tmp/foo.mp4
produced a file with the ac-3 sample entry, but no AC3SpecificBox (dac3) child, which is invalid according to ETSI TS 102 366.

Reviewed-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/movenc.c