1
0
Fork 0
forked from len0rd/rockbox

Fix FS#10476. Prevent FLAC bitrate calculation overflow with large files. The watermark depends on the bitrate, and so this also fixes playback pauses on large FLAC files.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22211 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Boris Gjenero 2009-08-08 20:27:03 +00:00
parent 978f3798a9
commit 7f971e0176
2 changed files with 3 additions and 2 deletions

View file

@ -172,7 +172,8 @@ static bool flac_init(FLACContext* fc, int first_frame_offset)
} }
if (found_streaminfo) { if (found_streaminfo) {
fc->bitrate = ((fc->filesize-fc->metadatalength) * 8) / fc->length; fc->bitrate = ((int64_t) (fc->filesize-fc->metadatalength) * 8)
/ fc->length;
return true; return true;
} else { } else {
return false; return false;

View file

@ -96,7 +96,7 @@ bool get_flac_metadata(int fd, struct mp3entry* id3)
return false; return false;
} }
id3->bitrate = (id3->filesize * 8) / id3->length; id3->bitrate = ((int64_t) id3->filesize * 8) / id3->length;
} }
else if (type == 4) /* 4 is the VORBIS_COMMENT block */ else if (type == 4) /* 4 is the VORBIS_COMMENT block */
{ {