diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2009-08-03 20:28:16 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2009-08-03 20:28:16 +0000 |
commit | 04be8dd7fe5378e39efbf5edd9ad447d17aabc06 (patch) | |
tree | 4df99c785b310009ac83a628338c1946f0c286cd | |
parent | 3de77e0d47556f1b30f01a3e83c5e1d8d0d953e8 (diff) | |
download | rockbox-04be8dd7fe5378e39efbf5edd9ad447d17aabc06.tar.gz rockbox-04be8dd7fe5378e39efbf5edd9ad447d17aabc06.zip |
Fix inaccurate time display for 44.1 (and 22.05) kHz MP3 audio tracks. Time was off by about 0.2%. Doesn't sound much, but after one hour, that's 8 seconds. Also fix a problem when seeking to near the end of a file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22145 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/mpa.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index d5b4d02889..f248744c50 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c @@ -130,13 +130,14 @@ static int get_file_pos(int newtime) return -1; } - pos += id3->first_frame_offset; - /* Don't seek right to the end of the file so that we can transition properly to the next song */ if (pos >= (int)(id3->filesize - id3->id3v1len)) pos = id3->filesize - id3->id3v1len - 1; + /* id3->filesize excludes id3->first_frame_offset, so add it now */ + pos += id3->first_frame_offset; + return pos; } @@ -492,7 +493,7 @@ next_track: } samplesdone += framelength; - ci->set_elapsed(samplesdone / (current_frequency / 1000)); + ci->set_elapsed((samplesdone * 1000) / current_frequency); } /* wait for synth idle - MT only*/ |