From 4c3a19f1b480c726b32d25e3b2fbaf3018a0d5e0 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 23 Nov 2008 23:54:27 +0000 Subject: 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 --- apps/plugins/test_codec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'apps') diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 3c54610a94..b1f5aff385 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); -- cgit v1.2.3