Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide
translations



Rockbox mail archive

Subject: Small rewind optimization hack

Small rewind optimization hack

From: Marcus Rating <Marcus.Rating_at_t-online.de>
Date: Tue, 04 Nov 2003 00:19:06 +0100

First, hello everyone; this is my first post here. So far I am really
happy with Rockbox and even made some small custom code changes already
to make my build more suitable for me. (Turning F3 into a pure Shuffle
On/Off switch)

Now, for a small thing I noticed: When I start playing a song and then
just after it finished accessing the disk for the first time rewind it
completely to the start (0:00), for example by just briefly pressing the
Rewind button, it starts spinning up the disk again. From checking the
code it seems that since it was already playing while buffering the
song, it discarded the first second(s) again in favor of later data.

The problem here is that where I mostly use my Jukebox (at work) I often
get interrupted briefly and then like to rewind the song, causing this
disk access every time, which more than destroys the slight advantage by
the additional buffering possible through discarding the part of the
song already played while still loading it.

For now, my quick-and-dirty solution is to increase the MPEG_HIGH_WATER
constant in firmware/export/mpeg.h from 2 bytes to 0x8000 (32 kb), which
in my testing was enough to prevent the buffer from rolling over like
this. If you are playing high-bitrate MP3s, this might need to be higher
though. While this would reduce battery life by about 2% if you play
without any rewinding, with my usage pattern I have gotten a significant
reduction in disk access out of it. (As a side-effect, it also feels
much nicer to be able to skip to the beginning of the song without any
delay)

I know this is probably not the best solution (one of the reasons I am
not submitting this as a patch); unfortunately the entire buffering code
is not really commented well enough for me to understand it right away
and write something better at the moment. Still, if you are bothered by
the disk access on rewind too, you might want to give this a try. Also,
I just wanted to say hi and thank everyone working on Rockbox!

Hope this helps,
  Marcus
Received on 2003-11-04

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy