diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-23 16:11:38 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-23 16:11:38 +0200 |
commit | d8f27eceaabf9746d863c9f880310015908bf86d (patch) | |
tree | 545817838fe33fd3f18bb320095dfc690fc605ad | |
parent | 8469fc17e28925591cfa5d74f4e145c526081ffe (diff) | |
download | ffmpeg-d8f27eceaabf9746d863c9f880310015908bf86d.tar.gz |
asfdec: ignore stored duration for truncated files
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/asfdec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index b58cf28064..d8bd245bd1 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -351,8 +351,10 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) asf_st->stream_language_index = 128; // invalid stream index means no language info if(!(asf->hdr.flags & 0x01)) { // if we aren't streaming... - st->duration = asf->hdr.play_time / - (10000000 / 1000) - start_time; + int64_t fsize = avio_size(pb); + if (fsize <= 0 || asf->hdr.file_size <= 0 || FFABS(fsize - asf->hdr.file_size) < 10000) + st->duration = asf->hdr.play_time / + (10000000 / 1000) - start_time; } ff_get_guid(pb, &g); |