aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2014-09-06 14:59:23 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-09-08 05:22:05 +0200
commite9c08e32d6b97cb7bfec29b38b3394be46dc3e70 (patch)
tree0135f12b9309d2ca6d3b00ce2cc825209730ed2f /libavformat
parentf044fc03727dcbe7535b393e06d8ab1bc0312a9c (diff)
downloadffmpeg-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')
-rw-r--r--libavformat/utils.c3
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