Fixed some mp3 metadata reading performance problem. Next track
switching should be more reliable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6691 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/playback.c b/apps/playback.c
index 0bd0c27..391f5e9 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -666,7 +666,7 @@
mp3info(&tracks[track_widx].id3, trackname, v1first);
lseek(fd, 0, SEEK_SET);
/* This is too slow to execute on some files. */
- // get_mp3file_info(fd, &tracks[track_widx].mp3data);
+ get_mp3file_info(fd, &tracks[track_widx].mp3data);
if (offset) {
lseek(fd, offset, SEEK_SET);
tracks[track_widx].id3.offset = offset;
@@ -1272,7 +1272,7 @@
case CODEC_LOAD:
if (status != PLUGIN_OK) {
logf("Codec failure");
- playing = false;
+ // playing = false;
} else {
logf("Codec finished");
}
diff --git a/firmware/mp3data.c b/firmware/mp3data.c
index 2b58710..6e553eb 100644
--- a/firmware/mp3data.c
+++ b/firmware/mp3data.c
@@ -37,6 +37,11 @@
#include "file.h"
#include "buffer.h"
+#if defined(IRIVER_H100) && !defined(SIMULATOR)
+#include "pcm_playback.h"
+#include "kernel.h"
+#endif
+
#define DEBUG_VERBOSE
#define BYTES2INT(b1,b2,b3,b4) (((long)(b1 & 0xFF) << (3*8)) | \
@@ -259,6 +264,13 @@
static int fileread(int fd, unsigned char *c)
{
+#if defined(IRIVER_H100) && !defined(SIMULATOR)
+ /* We don't want to eat all cpu power. Maybe better way to do this
+ should be implemented. */
+ while (pcm_is_lowdata())
+ yield();
+#endif
+
return read(fd, c, 1);
}
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index 2c63f8c..582f04c 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -44,7 +44,7 @@
/* Must be a power of 2 */
#define NUM_PCM_BUFFERS (PCMBUF_SIZE / CHUNK_SIZE)
#define NUM_PCM_BUFFERS_MASK (NUM_PCM_BUFFERS - 1)
-#define PCM_WATERMARK (CHUNK_SIZE * 3)
+#define PCM_WATERMARK (CHUNK_SIZE * 6)
static bool pcm_playing;
static bool pcm_paused;