summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-11-23 23:54:27 +0000
committerJens Arnold <amiconn@rockbox.org>2008-11-23 23:54:27 +0000
commit4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0 (patch)
treee5e7c815e3e17b41bc380750374d975f76b9e6af /apps/plugins
parentfda2e32d421d050d4a5b8af8c18d3fdc12e15b8a (diff)
downloadrockbox-4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0.zip
rockbox-4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0.tar.gz
rockbox-4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0.tar.bz2
rockbox-4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0.tar.xz
Fix test_codec precision. The old version effectively rounded the decode time up to full seconds (because of the rb->sleep(HZ)), so speed results from before this revision were more or less too low and 'stepped', especially for fast codecs and short test tracks.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19193 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/test_codec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 3c54610..b1f5aff 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -111,6 +111,7 @@ static bool taginfo_ready = true;
static volatile unsigned int elapsed;
static volatile bool codec_playing;
+static volatile long endtick;
struct wavinfo_t wavinfo;
static unsigned char wav_header[44] =
@@ -508,6 +509,7 @@ static void codec_thread(void)
res = rb->codec_load_file(codecname,&ci);
/* Signal to the main thread that we are done */
+ endtick = *rb->current_tick;
codec_playing = false;
}
@@ -519,8 +521,8 @@ static enum plugin_status test_track(const char* filename)
size_t n;
int fd;
enum plugin_status res = PLUGIN_ERROR;
- unsigned long starttick;
- unsigned long ticks;
+ long starttick;
+ long ticks;
unsigned long speed;
unsigned long duration;
struct thread_entry* codecthread_id;
@@ -601,8 +603,7 @@ static enum plugin_status test_track(const char* filename)
rb->snprintf(str,sizeof(str),"%d of %d",elapsed,(int)track.id3.length);
log_text(str,false);
}
- /* Save the current time before we spin up the disk to access the log */
- ticks = *rb->current_tick - starttick;
+ ticks = endtick - starttick;
/* Be sure it is done */
rb->thread_wait(codecthread_id);