On Tue, Jun 21, 2022 at 04:34:15AM +0200, Andreas Rheinhardt wrote: > Up until now, updating extradata was very ad-hoc: The amount of > space reserved for extradata was not recorded when writing the > header; instead the AAC code simply presumed that it was enough. > This commit changes this by recording how much space is available. > > This brings with it that the code for writing of and reserving space > for the CodecPrivate and for updating it diverges. They are therefore > split; this allows to put other common tasks like seeking to > right offset as well as writing padding (in case the new extradata did > not fill the whole reserved space) to this common function. > > The code for filling up the reserved space is smarter than the code > it replaces; therefore it is no longer necessary to reserve more > than necessary just to be sure that one can add an EBML Void element > (whose minimum size is two) lateron. This is the reason for the change > to the aac-autobsf-adtstoasc test. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/matroskaenc.c | 120 ++++++++++++++++++--------- > tests/ref/fate/aac-autobsf-adtstoasc | 4 +- > 2 files changed, 84 insertions(+), 40 deletions(-) triggers assert in fate ffmpeg/ffmpeg -nostdin -i fate-suite//audiomatch/tones_afconvert_16000_mono_aac_lc.m4a -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 -segment_list ffmpeg/tests/data/adts-to-mkv.m3u8 -y ffmpeg/tests/data/adts-to-mkv-%03d.mkv Metadata: major_brand : M4A minor_version : 0 compatible_brands: M4A mp42isom creation_time : 2024-12-23T09:22:20.000000Z iTunSMPB : 00000000 00000840 000002C0 0000000000007D00 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 Duration: 00:00:02.18, start: 0.132000, bitrate: 35 kb/s Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 20 kb/s (default) Metadata: creation_time : 2024-12-23T09:22:20.000000Z vendor_id : [0][0][0][0] [segment @ 0x562c56aa3f40] Opening 'ffmpeg/tests/data/adts-to-mkv-000.mkv' for writing Assertion codecpriv_size < max_payload_size failed at libavformat/matroskaenc.c:1239 Aborted (core dumped) [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Take away the freedom of one citizen and you will be jailed, take away the freedom of all citizens and you will be congratulated by your peers in Parliament.