avformat/movenc: Reduce size of the allocated MOVIentry array

Increasing it by 2048 entries per realloc is exessive.
Reduces memory usage, especially on long, non fragmented output.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-03-25 14:16:35 -03:00
parent e4dd8ee323
commit 59c993e227

View File

@ -5559,7 +5559,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (trk->entry >= trk->cluster_capacity) {
unsigned new_capacity = 2 * (trk->entry + MOV_INDEX_CLUSTER_SIZE);
unsigned new_capacity = trk->entry + MOV_INDEX_CLUSTER_SIZE;
if (av_reallocp_array(&trk->cluster, new_capacity,
sizeof(*trk->cluster))) {
ret = AVERROR(ENOMEM);