[FFmpeg-cvslog] mov: Don't use a negative duration for setting other fields
Martin Storsjö
git at videolan.org
Tue Oct 8 01:11:27 CEST 2013
ffmpeg | branch: release/1.1 | Martin Storsjö <martin at martin.st> | Mon Sep 16 20:17:47 2013 +0300| [fe8bc7d1ee098de7f6da4d841a651773370ca454] | committer: Luca Barbato
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 at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 7f8d41eb097e8d4223c9caf97dd332a2fdb29d52)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe8bc7d1ee098de7f6da4d841a651773370ca454
---
libavformat/mov.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index f652934..2ae19c9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2063,7 +2063,7 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
((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,
sc->time_scale*st->nb_frames, st->duration, INT_MAX);
@@ -2805,7 +2805,7 @@ static int mov_read_header(AVFormatContext *s)
for (i = 0; i < s->nb_streams; i++) {
AVStream *st = s->streams[i];
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;
}
}
More information about the ffmpeg-cvslog
mailing list