aboutsummaryrefslogtreecommitdiffstats
path: root/libavresample/audio_mix.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-12-30 15:48:35 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-03-30 06:18:31 +0200
commit5e3b7bd56d2c476a508c03e2029675bfd2618122 (patch)
tree0921bebc032600011f27190377844921a0653927 /libavresample/audio_mix.c
parent639728f51a9fa5e321effad5909c1e37df0e80bb (diff)
downloadffmpeg-5e3b7bd56d2c476a508c03e2029675bfd2618122.tar.gz
avformat/matroskaenc: Simplify writing Cues
When the Matroska muxer writes the Cues (the index), it groups index entries with the same timestamp into the same CuePoint to save space. But given Matroska's variable-length length fields, it either needs to have an upper bound of the final size of the CuePoint before writing it or the CuePoint has to be assembled in a different buffer, so that after having assembled the CuePoint (when the real size is known), the CuePoint's header can be written and its data copied after it. The first of these approaches is the currently used one. This entails finding out the number of entries in a CuePoint before starting the CuePoint and therefore means that the list is read at least twice. Furthermore, a worst-case upper-bound for the length of a single entry was used, so that sometimes bytes are wasted on length fields. This commit switches to the second approach. This is no longer more expensive than the current approach if one only resets the dynamic buffer used to write the CuePoint's content instead of opening a new buffer for every CuePoint: Writing the trailer of a file with 540.000 CuePoints improved actually from 219054414 decicycles to 2164379394 decicycles (based upon 50 iterations). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavresample/audio_mix.c')
0 files changed, 0 insertions, 0 deletions