diff options
author | Nils Wallménius <nils@rockbox.org> | 2012-10-25 20:04:52 +0200 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-10-25 20:04:52 +0200 |
commit | 54ef3066101e68a9058e98ba8498d1a7ffce8ba9 (patch) | |
tree | dd57807171ab7e8da3a18e49fdecc261dc72769e | |
parent | c1ec1ec89962ded5ae4acefc33c6a445f5b4c3f5 (diff) | |
download | rockbox-54ef306.tar.gz rockbox-54ef306.zip |
flac: use 64 bit math to calculate the elapsed time
avoids overflows for very long files
Change-Id: Idb1e9a411bd9007cfddbbd2d3dcf127645fa9a7c
-rw-r--r-- | lib/rbcodec/codecs/flac.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rbcodec/codecs/flac.c b/lib/rbcodec/codecs/flac.c index e10403819c..e8588d3c95 100644 --- a/lib/rbcodec/codecs/flac.c +++ b/lib/rbcodec/codecs/flac.c @@ -483,7 +483,7 @@ enum codec_status codec_run(void) flac_seek_offset(&fc, samplesdone); samplesdone=fc.samplenumber+fc.blocksize; - elapsedtime=(samplesdone*10)/(ci->id3->frequency/100); + elapsedtime=((uint64_t)samplesdone*1000)/(ci->id3->frequency); ci->set_elapsed(elapsedtime); /* The main decoding loop */ @@ -523,7 +523,7 @@ enum codec_status codec_run(void) /* Update the elapsed-time indicator */ samplesdone=fc.samplenumber+fc.blocksize; - elapsedtime=(samplesdone*10)/(ci->id3->frequency/100); + elapsedtime=((uint64_t)samplesdone*1000)/(ci->id3->frequency); ci->set_elapsed(elapsedtime); ci->advance_buffer(consumed); |