aboutsummaryrefslogtreecommitdiffstats
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 23:08:55 +0200
commit6011b806dd5d608a52df9cb1956e1dd099058687 (patch)
tree59465d34e871cb9394656132205e866bb6f387a4
parent3ac85d70f09dd8ffa96c3f4a13a93f0f465ba6a4 (diff)
downloadffmpeg-6011b806dd5d608a52df9cb1956e1dd099058687.tar.gz
Show duration for large asf files as written in the file header.
Fixes ticket #3428. (cherry picked from commit e3fd263f0b73e4425192d6dd1ab18027ecaa35db)
-rw-r--r--libavformat/asfdec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index de42b45a8e..7c7105a9cb 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -378,7 +378,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;
}