diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2014-09-06 14:59:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-09-08 05:22:05 +0200 |
commit | e9c08e32d6b97cb7bfec29b38b3394be46dc3e70 (patch) | |
tree | 0135f12b9309d2ca6d3b00ce2cc825209730ed2f /libavformat/utils.c | |
parent | f044fc03727dcbe7535b393e06d8ab1bc0312a9c (diff) | |
download | ffmpeg-e9c08e32d6b97cb7bfec29b38b3394be46dc3e70.tar.gz |
avformat/utils: Exclude the header size when computing duration from bit_rate
This improves the estimate for MP3s with cover art tags.
Fixes Ticket2931
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 6e828f7ce9..d6e3e50d66 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2287,7 +2287,8 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic) if (ic->duration == AV_NOPTS_VALUE && ic->bit_rate != 0) { filesize = ic->pb ? avio_size(ic->pb) : 0; - if (filesize > 0) { + if (filesize > ic->data_offset) { + filesize -= ic->data_offset; for (i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; if ( st->time_base.num <= INT64_MAX / ic->bit_rate |