1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
FFmpeg/tests/ref/fate/aac-autobsf-adtstoasc
Andreas Rheinhardt dc2f6b54ac avformat/matroskaenc: Avoid allocations for SeekHead
Up until e7ddafd5, the Matroska muxer wrote two SeekHeads: One at the
beginning referencing the main level 1 elements (i.e. not the Clusters)
and one at the end, referencing the Clusters. This second SeekHead was
useless and has therefore been removed. Yet the SeekHead-related
functions and structures are still geared towards this usecase: They
are built around an allocated array of variable size that gets
reallocated every time an element is added to it although the maximum
number of Seek entries is a small compile-time constant, so that one should
rather include the array in the SeekHead structure itself; and said
structure should be contained in the MatroskaMuxContext instead of being
allocated separately.

The earlier code reserved space for a SeekHead with 10 entries, although
we currently write at most 6. Reducing said number implied that every
Matroska/Webm file will be 84 bytes smaller and required to adapt
several FATE tests; furthermore, the reserved amount overestimated the
amount needed for for the SeekHead's length field and how many bytes
need to be reserved to write a EBML Void element, bringing the total
reduction to 89 bytes.

This also fixes a potential segfault: If !mkv->is_live and if the
AVIOContext is initially unseekable when writing the header, the
SeekHead is already written when writing the header and this used to
free the SeekHead-related structures that have been allocated. But if
the AVIOContext happens to be seekable when writing the trailer, it will
be attempted to write the SeekHead again which will lead to segfaults
because the corresponding structures have already been freed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-26 03:19:56 +01:00

44 lines
2.2 KiB
Plaintext

d10b73732b32f6b2f08885b40c41c77f *tests/data/fate/aac-autobsf-adtstoasc.matroska
6606 tests/data/fate/aac-autobsf-adtstoasc.matroska
#extradata 0: 2, 0x0030001c
#tb 0: 1/1000
#media_type 0: audio
#codec_id 0: aac
#sample_rate 0: 16000
#channel_layout 0: 4
#channel_layout_name 0: mono
0, 0, 0, 64, 4, 0x02f70117
0, 64, 64, 64, 163, 0xd5f85007
0, 128, 128, 64, 127, 0x66484065
0, 192, 192, 64, 94, 0x55222bd6
0, 256, 256, 64, 314, 0x3c7e923a
0, 320, 320, 64, 207, 0x1efc5d1b
0, 384, 384, 64, 119, 0xb2a13601
0, 448, 448, 64, 184, 0xcafc6091
0, 512, 512, 64, 132, 0xddd33c0b
0, 576, 576, 64, 152, 0x83935031
0, 640, 640, 64, 227, 0x32a86bc4
0, 704, 704, 64, 122, 0xd04e3571
0, 768, 768, 64, 163, 0x57d44d16
0, 832, 832, 64, 147, 0x226043d7
0, 896, 896, 64, 119, 0x8ad931ed
0, 960, 960, 64, 153, 0xbb6e432f
0, 1024, 1024, 64, 185, 0xa01f4ff3
0, 1088, 1088, 64, 126, 0x85503ce6
0, 1152, 1152, 64, 246, 0x652c7b59
0, 1216, 1216, 64, 162, 0xc9f04da0
0, 1280, 1280, 64, 135, 0x71fa3be0
0, 1344, 1344, 64, 246, 0x7a6f7788
0, 1408, 1408, 64, 262, 0xd3097781
0, 1472, 1472, 64, 60, 0x09a118f5
0, 1536, 1536, 64, 255, 0xbab5793c
0, 1600, 1600, 64, 153, 0x6b6a44fb
0, 1664, 1664, 64, 160, 0x550e4530
0, 1728, 1728, 64, 215, 0x7fe66144
0, 1792, 1792, 64, 144, 0xcd723f7d
0, 1856, 1856, 64, 187, 0x2a0b5c1b
0, 1920, 1920, 64, 177, 0xb8c355d5
0, 1984, 1984, 64, 156, 0x867d4f3a
0, 2048, 2048, 64, 201, 0x62745ff9
0, 2112, 2112, 64, 137, 0x90c639e0