• Andreas Rheinhardt's avatar
    avformat/matroskaenc: Avoid allocations for SeekHead · dc2f6b54
    Andreas Rheinhardt authored
    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: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    dc2f6b54
Name
Last commit
Last update
..
acodec-adpcm-ima_qt Loading commit data...
acodec-adpcm-ima_qt-trellis Loading commit data...
acodec-adpcm-ima_wav Loading commit data...
acodec-adpcm-ima_wav-trellis Loading commit data...
acodec-adpcm-ms Loading commit data...
acodec-adpcm-ms-trellis Loading commit data...
acodec-adpcm-swf Loading commit data...
acodec-adpcm-swf-trellis Loading commit data...
acodec-adpcm-yamaha Loading commit data...
acodec-adpcm-yamaha-trellis Loading commit data...
acodec-alac Loading commit data...
acodec-flac Loading commit data...
acodec-mp2 Loading commit data...
acodec-pcm-alaw Loading commit data...
acodec-pcm-f32be Loading commit data...
acodec-pcm-f32le Loading commit data...
acodec-pcm-f64be Loading commit data...
acodec-pcm-f64le Loading commit data...
acodec-pcm-mulaw Loading commit data...
acodec-pcm-s16be Loading commit data...
acodec-pcm-s16le Loading commit data...
acodec-pcm-s24be Loading commit data...
acodec-pcm-s24le Loading commit data...
acodec-pcm-s32be Loading commit data...
acodec-pcm-s32le Loading commit data...
acodec-pcm-s8 Loading commit data...
acodec-pcm-u8 Loading commit data...
cache-pipe Loading commit data...
empty-edit-mp4 Loading commit data...
extra-mp3 Loading commit data...
extra-mp4 Loading commit data...
lavf-aiff Loading commit data...
lavf-al Loading commit data...
lavf-asf Loading commit data...
lavf-au Loading commit data...
lavf-avi Loading commit data...
lavf-bmp Loading commit data...
lavf-dv Loading commit data...
lavf-flv Loading commit data...
lavf-gif Loading commit data...
lavf-gxf Loading commit data...
lavf-jpg Loading commit data...
lavf-mkv Loading commit data...
lavf-mmf Loading commit data...
lavf-mov Loading commit data...
lavf-mpg Loading commit data...
lavf-mxf Loading commit data...
lavf-mxf_d10 Loading commit data...
lavf-mxf_dv25 Loading commit data...
lavf-mxf_dvcpro50 Loading commit data...
lavf-mxf_opatom Loading commit data...
lavf-mxf_opatom_audio Loading commit data...
lavf-nut Loading commit data...
lavf-ogg Loading commit data...
lavf-pbmpipe Loading commit data...
lavf-pcx Loading commit data...
lavf-pgm Loading commit data...
lavf-pgmpipe Loading commit data...
lavf-ppm Loading commit data...
lavf-ppmpipe Loading commit data...
lavf-rm Loading commit data...
lavf-sgi Loading commit data...
lavf-swf Loading commit data...
lavf-tga Loading commit data...
lavf-tiff Loading commit data...
lavf-ts Loading commit data...
lavf-ul Loading commit data...
lavf-voc Loading commit data...
lavf-wav Loading commit data...
lavf-wtv Loading commit data...
lavf-y4m Loading commit data...
mkv-codec-delay Loading commit data...
test-iibbibb-mp4 Loading commit data...
test-iibbibb-neg-ctts-mp4 Loading commit data...
vsynth_lena-asv1 Loading commit data...
vsynth_lena-asv2 Loading commit data...
vsynth_lena-dnxhd-1080i Loading commit data...
vsynth_lena-dnxhd-4k-hr-lb Loading commit data...
vsynth_lena-dnxhd-720p Loading commit data...
vsynth_lena-dnxhd-720p-rd Loading commit data...
vsynth_lena-dv Loading commit data...
vsynth_lena-dv-411 Loading commit data...
vsynth_lena-dv-50 Loading commit data...
vsynth_lena-ffv1 Loading commit data...
vsynth_lena-flashsv Loading commit data...
vsynth_lena-flv Loading commit data...
vsynth_lena-h261 Loading commit data...
vsynth_lena-h263 Loading commit data...
vsynth_lena-h263p Loading commit data...
vsynth_lena-huffyuv Loading commit data...
vsynth_lena-jpegls Loading commit data...
vsynth_lena-ljpeg Loading commit data...
vsynth_lena-mjpeg Loading commit data...
vsynth_lena-mpeg1 Loading commit data...
vsynth_lena-mpeg1b Loading commit data...
vsynth_lena-mpeg2-422 Loading commit data...
vsynth_lena-mpeg2-idct-int Loading commit data...
vsynth_lena-mpeg2-ilace Loading commit data...
vsynth_lena-mpeg2-ivlc-qprd Loading commit data...
vsynth_lena-mpeg2-thread Loading commit data...
vsynth_lena-mpeg2-thread-ivlc Loading commit data...
vsynth_lena-mpeg4 Loading commit data...
vsynth_lena-mpeg4-adap Loading commit data...
vsynth_lena-mpeg4-adv Loading commit data...
vsynth_lena-mpeg4-error Loading commit data...
vsynth_lena-mpeg4-nr Loading commit data...
vsynth_lena-mpeg4-nsse Loading commit data...
vsynth_lena-mpeg4-qpel Loading commit data...
vsynth_lena-mpeg4-qprd Loading commit data...
vsynth_lena-mpeg4-rc Loading commit data...
vsynth_lena-mpeg4-thread Loading commit data...
vsynth_lena-msmpeg4 Loading commit data...
vsynth_lena-msmpeg4v2 Loading commit data...
vsynth_lena-rgb Loading commit data...
vsynth_lena-roqvideo Loading commit data...
vsynth_lena-rv10 Loading commit data...
vsynth_lena-rv20 Loading commit data...
vsynth_lena-snow Loading commit data...
vsynth_lena-snow-ll Loading commit data...
vsynth_lena-svq1 Loading commit data...
vsynth_lena-wmv1 Loading commit data...
vsynth_lena-wmv2 Loading commit data...
vsynth_lena-yuv Loading commit data...