diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-05-03 01:06:37 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-05-09 16:18:39 +0200 |
commit | d0bd00c8ebdc4a482db553b2ca8c1e14fe105d72 (patch) | |
tree | 9b10d1a8d552ee3bf5f559c6fc2eba65c3d29ae4 /libavresample/arm/audio_convert_init.c | |
parent | de7b690300be8c7423aa9625fa0ee5637ff38673 (diff) | |
download | ffmpeg-d0bd00c8ebdc4a482db553b2ca8c1e14fe105d72.tar.gz |
avformat/oggenc: Avoid allocating and copying when writing page data
When the Ogg muxer writes a page, it has to do three things: It needs to
write a page header, then it has to actually copy the page data and then
it has to calculate and write a CRC checksum of both header as well as
data at a certain position in the page header.
To do this, the muxer used a dynamic buffer for both writing as well as
calculating the checksum via an AVIOContext's feature to automatically
calculate checksums on the data it writes. This entails an allocation of
an AVIOContext, of the opaque specific to dynamic buffers and of the
buffer itself (which may be reallocated multiple times) as well as
memcopying the data (first into the AVIOContext's small write buffer,
then into the dynamic buffer's big buffer).
This commit changes this: The page header is no longer written into a
dynamic buffer any more; instead the (small) page header is written into
a small buffer on the stack. The CRC is then calculated directly via
av_crc() on both the page header as well as the page data. Then both the
page header and the page data are written.
Finally, ogg_write_page() can now no longer fail, so it has been
modified to return nothing; this also fixed a bug in the only caller of
this function: It didn't check the return value.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavresample/arm/audio_convert_init.c')
0 files changed, 0 insertions, 0 deletions