aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/nutenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-29 03:48:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-29 03:49:16 +0200
commit6d1aba6a29b477ae69ca527812f10db5c025cf91 (patch)
tree4c895ae30acec5cec36e2e3cb0d297ca7524f4bd /libavformat/nutenc.c
parent82beb46e65e5f820b187355bf757725c22a59c45 (diff)
downloadffmpeg-6d1aba6a29b477ae69ca527812f10db5c025cf91.tar.gz
avformat/nutenc: limit index table size if no index is going to be written
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/nutenc.c')
-rw-r--r--libavformat/nutenc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 0bed15ae0d..9920a39da3 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -1002,8 +1002,15 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
AV_ROUND_DOWN);
int index = av_index_search_timestamp(st, dts_tb,
AVSEEK_FLAG_BACKWARD);
- if (index >= 0)
+ if (index >= 0) {
sp_pos = FFMIN(sp_pos, st->index_entries[index].pos);
+ if (!nut->write_index && 2*index > st->nb_index_entries) {
+ memmove(st->index_entries,
+ st->index_entries + index,
+ sizeof(*st->index_entries) * (st->nb_index_entries - index));
+ st->nb_index_entries -= index;
+ }
+ }
}
nut->last_syncpoint_pos = avio_tell(bc);