You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
mov: Don't use a negative duration for setting other fields
Some files have the duration set to -1 in the mdhd atom, more or less legitimately. (We produce such files ourselves, for the initial duration in fragmented mp4 files.) Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
@@ -2130,7 +2130,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
((double)st->codec->width * sc->height), INT_MAX);
|
((double)st->codec->width * sc->height), INT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st->duration != AV_NOPTS_VALUE)
|
if (st->duration != AV_NOPTS_VALUE && st->duration > 0)
|
||||||
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
|
av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den,
|
||||||
sc->time_scale*st->nb_frames, st->duration, INT_MAX);
|
sc->time_scale*st->nb_frames, st->duration, INT_MAX);
|
||||||
}
|
}
|
||||||
@@ -2863,7 +2863,7 @@ static int mov_read_header(AVFormatContext *s)
|
|||||||
for (i = 0; i < s->nb_streams; i++) {
|
for (i = 0; i < s->nb_streams; i++) {
|
||||||
AVStream *st = s->streams[i];
|
AVStream *st = s->streams[i];
|
||||||
MOVStreamContext *sc = st->priv_data;
|
MOVStreamContext *sc = st->priv_data;
|
||||||
if (st->duration)
|
if (st->duration > 0)
|
||||||
st->codec->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration;
|
st->codec->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user