diff options
| author | Boris Gjenero <dreamlayers@rockbox.org> | 2009-08-08 20:27:03 +0000 |
|---|---|---|
| committer | Boris Gjenero <dreamlayers@rockbox.org> | 2009-08-08 20:27:03 +0000 |
| commit | 7f971e017670880685be276898ec80189ee0940b (patch) | |
| tree | 13284277129276e5babaab2e2e5d96614514898b | |
| parent | 978f3798a9f00b89ee56f42e10ba2d8daa9cffae (diff) | |
| download | rockbox-7f971e017670880685be276898ec80189ee0940b.zip rockbox-7f971e017670880685be276898ec80189ee0940b.tar.gz rockbox-7f971e017670880685be276898ec80189ee0940b.tar.bz2 rockbox-7f971e017670880685be276898ec80189ee0940b.tar.xz | |
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
| -rw-r--r-- | apps/codecs/flac.c | 3 | ||||
| -rw-r--r-- | apps/metadata/flac.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c index cc3f683..3f2f369 100644 --- a/apps/codecs/flac.c +++ b/apps/codecs/flac.c @@ -172,7 +172,8 @@ static bool flac_init(FLACContext* fc, int first_frame_offset) } 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; } else { return false; diff --git a/apps/metadata/flac.c b/apps/metadata/flac.c index 21ecdd6..b8f440c 100644 --- a/apps/metadata/flac.c +++ b/apps/metadata/flac.c @@ -96,7 +96,7 @@ bool get_flac_metadata(int fd, struct mp3entry* id3) 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 */ { |