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/mpc.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/mpc.c')
-rw-r--r-- | lib/rbcodec/codecs/mpc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rbcodec/codecs/mpc.c b/lib/rbcodec/codecs/mpc.c index a856f6f3d1..44c286ba0a 100644 --- a/lib/rbcodec/codecs/mpc.c +++ b/lib/rbcodec/codecs/mpc.c | |||
@@ -140,7 +140,7 @@ enum codec_status codec_run(void) | |||
140 | samplesdone = 0; | 140 | samplesdone = 0; |
141 | } | 141 | } |
142 | 142 | ||
143 | elapsed_time = (samplesdone*10)/frequency; | 143 | elapsed_time = (samplesdone*10LL)/frequency; |
144 | } | 144 | } |
145 | 145 | ||
146 | ci->set_elapsed(elapsed_time); | 146 | ci->set_elapsed(elapsed_time); |
@@ -162,7 +162,7 @@ enum codec_status codec_run(void) | |||
162 | samplesdone = new_offset; | 162 | samplesdone = new_offset; |
163 | } | 163 | } |
164 | 164 | ||
165 | elapsed_time = (samplesdone*10)/frequency; | 165 | elapsed_time = (samplesdone*10LL)/frequency; |
166 | ci->set_elapsed(elapsed_time); | 166 | ci->set_elapsed(elapsed_time); |
167 | ci->seek_complete(); | 167 | ci->seek_complete(); |
168 | } | 168 | } |
@@ -182,7 +182,7 @@ enum codec_status codec_run(void) | |||
182 | frame.buffer + MPC_FRAME_LENGTH, | 182 | frame.buffer + MPC_FRAME_LENGTH, |
183 | frame.samples); | 183 | frame.samples); |
184 | samplesdone += frame.samples; | 184 | samplesdone += frame.samples; |
185 | elapsed_time = (samplesdone*10)/frequency; | 185 | elapsed_time = (samplesdone*10LL)/frequency; |
186 | ci->set_elapsed(elapsed_time); | 186 | ci->set_elapsed(elapsed_time); |
187 | /* Remark: rockbox offset is the file offset in bytes. So estimate | 187 | /* Remark: rockbox offset is the file offset in bytes. So estimate |
188 | * this offset from the samples, sampling frequency and bitrate */ | 188 | * this offset from the samples, sampling frequency and bitrate */ |