summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorAndrey Semashev <andysem@mail.ru>2013-06-03 13:32:48 +0300
committerMartin Storsjö <martin@martin.st>2013-06-04 15:05:31 +0300
commitab1189766a82a95f108005463cde75f73fcc0ae5 (patch)
treebc5d3823b39968362e9ed5c473ef1ece1763f633 /libavformat/movenc.c
parent3b4feac1ec14f861bdd7f494f288f4d8dd7f449e (diff)
movenc: Increase the cluster array allocation by doubling
The previous allocation increment of 16384 meant that the cluster array was allocated for 0.6 MB initially, which is a bit excessive for cases with fragmentation where only a fraction of that ever actually is used. Therefore, start off at a much smaller value, and increase by doubling (to avoid reallocating too often when writing long non-fragmented mp4 files). Bug-Id: 525 Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e2591681a5..e819d75b88 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2870,7 +2870,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (trk->entry >= trk->cluster_capacity) {
- unsigned new_capacity = trk->entry + MOV_INDEX_CLUSTER_SIZE;
+ unsigned new_capacity = 2*(trk->entry + MOV_INDEX_CLUSTER_SIZE);
if (av_reallocp_array(&trk->cluster, new_capacity,
sizeof(*trk->cluster)))
return AVERROR(ENOMEM);