summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorNigel Touati-Evans <nigel.touatievans@gmail.com>2013-07-04 16:51:32 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-07-05 22:07:48 +0200
commitef8cc06d6e50d3da7b781e126a3bce7929b53a55 (patch)
tree6e609807b97f41df026766967997cf3fc0e125b0 /libavformat
parent6516a25f04edc90b8dbc8b7f48120b08b7517ae2 (diff)
avformat/avidec: Fix incorrect detection of badly interleaved avi
The method guess_ni_flag needs to divide timestamps in the index by sample_size if it is set in order to compare different streams correctly. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avidec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index f5c234552d..a09bebd57c 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1397,15 +1397,16 @@ static int guess_ni_flag(AVFormatContext *s){
for (i=0; i<s->nb_streams; i++) {
AVStream *st = s->streams[i];
+ AVIStream *ast = st->priv_data;
int n= st->nb_index_entries;
while (idx[i]<n && st->index_entries[idx[i]].pos < pos)
idx[i]++;
if (idx[i] < n) {
- min_dts = FFMIN(min_dts, av_rescale_q(st->index_entries[idx[i]].timestamp, st->time_base, AV_TIME_BASE_Q));
+ min_dts = FFMIN(min_dts, av_rescale_q(st->index_entries[idx[i]].timestamp/FFMAX(ast->sample_size, 1), st->time_base, AV_TIME_BASE_Q));
min_pos = FFMIN(min_pos, st->index_entries[idx[i]].pos);
}
if (idx[i])
- max_dts = FFMAX(max_dts, av_rescale_q(st->index_entries[idx[i]-1].timestamp, st->time_base, AV_TIME_BASE_Q));
+ max_dts = FFMAX(max_dts, av_rescale_q(st->index_entries[idx[i]-1].timestamp/FFMAX(ast->sample_size, 1), st->time_base, AV_TIME_BASE_Q));
}
if(max_dts - min_dts > 2*AV_TIME_BASE) {
av_free(idx);