Commit 62056d09 authored by Don Moir's avatar Don Moir Committed by Michael Niedermayer

avformat/avidec: skip len=0 entries from the index

Reduces cpu & memory requirements for the index
See Ticket 3531
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent cdac3ab5
...@@ -224,7 +224,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num) ...@@ -224,7 +224,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num)
if (last_pos == pos || pos == base - 8) if (last_pos == pos || pos == base - 8)
avi->non_interleaved = 1; avi->non_interleaved = 1;
if (last_pos != pos && (len || !ast->sample_size)) if (last_pos != pos && len)
av_add_index_entry(st, pos, ast->cum_len, len, 0, av_add_index_entry(st, pos, ast->cum_len, len, 0,
key ? AVINDEX_KEYFRAME : 0); key ? AVINDEX_KEYFRAME : 0);
...@@ -1226,7 +1226,7 @@ start_sync: ...@@ -1226,7 +1226,7 @@ start_sync:
ast->packet_size = size + 8; ast->packet_size = size + 8;
ast->remaining = size; ast->remaining = size;
if (size || !ast->sample_size) { if (size) {
uint64_t pos = avio_tell(pb) - 8; uint64_t pos = avio_tell(pb) - 8;
if (!st->index_entries || !st->nb_index_entries || if (!st->index_entries || !st->nb_index_entries ||
st->index_entries[st->nb_index_entries - 1].pos < pos) { st->index_entries[st->nb_index_entries - 1].pos < pos) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment