• Andreas Rheinhardt's avatar
    avformat/matroskaenc: Write level 1 elements in one go · 47727579
    Andreas Rheinhardt authored
    Up until now, writing level 1 elements proceeded as follows: First, the
    element id was written to the ordinary output AVIOContext and a dynamic
    buffer was opened for the content of the level 1 element in
    start_ebml_master_crc32(). Then this buffer was actually used and after it
    was closed (in end_ebml_master_crc32()), the size field corresponding to
    the buffer's size was written, after which the actual data was written.
    
    This commit changes this: Nothing is written to the main AVIOContext any
    more in start_ebml_master_crc32(). end_ebml_master_crc32() now writes
    both the id, the length field as well as the data. This is benefical for
    streaming, because a client that receives just a Cluster ID and nothing
    more might infer that this is EOF; in certain usecases there is also the
    danger of a client receiving the Cluster without the actual Cluster ID
    at the beginning.
    
    Addresses #8578.
    
    (cherry picked from commit d9c21ec6)
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    47727579