lavf: move generic index generation code to a later point

By moving it to a later point relative and unknown timestamps
are more likely to have been corrected

similar patch reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Conflicts:

	libavformat/utils.c
This commit is contained in:
Michael Niedermayer 2012-07-24 18:00:11 +02:00
parent 2880c31660
commit 2cd491a47c
2 changed files with 11 additions and 17 deletions

View file

@ -1233,14 +1233,6 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
compute_pkt_fields(s, st, st->parser, &out_pkt);
if ((s->iformat->flags & AVFMT_GENERIC_INDEX) &&
out_pkt.flags & AV_PKT_FLAG_KEY) {
int64_t pos= out_pkt.pos;
ff_reduce_index(s, st->index);
av_add_index_entry(st, pos, out_pkt.dts,
0, 0, AVINDEX_KEYFRAME);
}
if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) {
out_pkt.destruct = pkt->destruct;
pkt->destruct = NULL;
@ -1468,10 +1460,16 @@ return_packet:
st->skip_samples = 0;
}
if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY) {
ff_reduce_index(s, st->index);
av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME);
}
if (is_relative(pkt->dts))
pkt->dts -= RELATIVE_TS_BASE;
if (is_relative(pkt->pts))
pkt->pts -= RELATIVE_TS_BASE;
return ret;
}