aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2014-06-21 19:35:06 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2014-06-21 21:52:05 +0200
commit52572ca1b33932eb4db01acc1fb37e85264efbab (patch)
tree7dbef124e39382eec993158549414fb2ddef55c5 /libavformat
parent220bbc44c2cfc9c291b16b9fdd6ee70d27298d8b (diff)
downloadffmpeg-52572ca1b33932eb4db01acc1fb37e85264efbab.tar.gz
Show duration for large asf files as written in the file header.
Fixes ticket #3428. (cherry picked from commit e3fd263f0b73e4425192d6dd1ab18027ecaa35db)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asfdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 093e328a8d..9bbc70467d 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -370,7 +370,8 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
if (!(asf->hdr.flags & 0x01)) { // if we aren't streaming...
int64_t fsize = avio_size(pb);
- if (fsize <= 0 || (int64_t)asf->hdr.file_size <= 0 || FFABS(fsize - (int64_t)asf->hdr.file_size) < 10000)
+ if (fsize <= 0 || (int64_t)asf->hdr.file_size <= 0 ||
+ FFABS(fsize - (int64_t)asf->hdr.file_size) / (float)FFMIN(fsize, asf->hdr.file_size) < 0.05)
st->duration = asf->hdr.play_time /
(10000000 / 1000) - start_time;
}