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>
This commit is contained in:
Hendrik Leppkes 2014-09-06 14:59:23 +02:00 committed by Michael Niedermayer
parent f044fc0372
commit e9c08e32d6

View File

@ -2287,7 +2287,8 @@ static void estimate_timings_from_bit_rate(AVFormatContext *ic)
if (ic->duration == AV_NOPTS_VALUE && if (ic->duration == AV_NOPTS_VALUE &&
ic->bit_rate != 0) { ic->bit_rate != 0) {
filesize = ic->pb ? avio_size(ic->pb) : 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++) { for (i = 0; i < ic->nb_streams; i++) {
st = ic->streams[i]; st = ic->streams[i];
if ( st->time_base.num <= INT64_MAX / ic->bit_rate if ( st->time_base.num <= INT64_MAX / ic->bit_rate