diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2018-10-15 17:59:13 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2018-10-29 19:50:34 +0100 |
commit | 20b91a83d3078eeabc02a4d214f6d44c64282f89 (patch) | |
tree | 00a182ef2240e6edc5a88ae4cf037479f5fa042c /lib/rbcodec/codecs/ape.c | |
parent | 0120ecd651a2ff3f8e202a704d6e73b705cf81d0 (diff) | |
download | rockbox-20b91a83d3078eeabc02a4d214f6d44c64282f89.tar.gz rockbox-20b91a83d3078eeabc02a4d214f6d44c64282f89.zip |
codecs: Fix elapsed time calculation for large files
In particular, this solves seeking glitches seen in ~6 hr mp3 files.
(Patch taken from Igor Poretsky's tree)
Change-Id: Id65b6726146b6d2d1a223e90b88e401d1b2d597a
Diffstat (limited to 'lib/rbcodec/codecs/ape.c')
-rw-r--r-- | lib/rbcodec/codecs/ape.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/rbcodec/codecs/ape.c b/lib/rbcodec/codecs/ape.c index 0adc793ade..937af1945f 100644 --- a/lib/rbcodec/codecs/ape.c +++ b/lib/rbcodec/codecs/ape.c | |||
@@ -218,7 +218,7 @@ enum codec_status codec_run(void) | |||
218 | 218 | ||
219 | ape_resume(&ape_ctx, resume_offset, | 219 | ape_resume(&ape_ctx, resume_offset, |
220 | ¤tframe, &samplesdone, &samplestoskip, &firstbyte); | 220 | ¤tframe, &samplesdone, &samplestoskip, &firstbyte); |
221 | elapsedtime = (samplesdone*10)/(ape_ctx.samplerate/100); | 221 | elapsedtime = samplesdone*1000LL/ape_ctx.samplerate; |
222 | } | 222 | } |
223 | else { | 223 | else { |
224 | currentframe = 0; | 224 | currentframe = 0; |
@@ -285,8 +285,7 @@ frame_start: | |||
285 | inbuffer = ci->request_buffer(&bytesleft, | 285 | inbuffer = ci->request_buffer(&bytesleft, |
286 | INPUT_CHUNKSIZE); | 286 | INPUT_CHUNKSIZE); |
287 | 287 | ||
288 | elapsedtime = (samplesdone*10)/ | 288 | elapsedtime = samplesdone*1000LL/ape_ctx.samplerate; |
289 | (ape_ctx.samplerate/100); | ||
290 | ci->set_elapsed(elapsedtime); | 289 | ci->set_elapsed(elapsedtime); |
291 | ci->seek_complete(); | 290 | ci->seek_complete(); |
292 | action = CODEC_ACTION_NULL; | 291 | action = CODEC_ACTION_NULL; |
@@ -330,7 +329,7 @@ frame_start: | |||
330 | 329 | ||
331 | if (!samplestoskip) { | 330 | if (!samplestoskip) { |
332 | /* Update the elapsed-time indicator */ | 331 | /* Update the elapsed-time indicator */ |
333 | elapsedtime = (samplesdone*10)/(ape_ctx.samplerate/100); | 332 | elapsedtime = samplesdone*1000LL/ape_ctx.samplerate; |
334 | ci->set_elapsed(elapsedtime); | 333 | ci->set_elapsed(elapsedtime); |
335 | } | 334 | } |
336 | 335 | ||