summaryrefslogtreecommitdiffstats
path: root/apps/codecs/mpa.c
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2008-09-22 01:29:50 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2008-09-22 01:29:50 +0000
commit3dedcfc454c88d585bc7822509fb254532616eab (patch)
tree1f8143d832c73c319367b72cc33258910517eafa /apps/codecs/mpa.c
parent3e9ca1de90ececc4f5c57058c565275823c0f800 (diff)
downloadrockbox-3dedcfc454c88d585bc7822509fb254532616eab.tar.gz
rockbox-3dedcfc454c88d585bc7822509fb254532616eab.zip
Hopefully fix glitches when seeking in MP3s on dual core processors. Also, clean up initialization and preprocessor commands.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18563 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/mpa.c')
-rw-r--r--apps/codecs/mpa.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index c916aefcaa..e81d8d96c0 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -25,8 +25,7 @@
CODEC_HEADER
-#if (CONFIG_CPU == PP5024 || CONFIG_CPU == PP5022 || CONFIG_CPU == PP5020 \
- || CONFIG_CPU == PP5002) && !defined(MPEGPLAYER)
+#if defined(CPU_PP) && !defined(MPEGPLAYER)
#define MPA_SYNTH_ON_COP
#endif
@@ -64,8 +63,12 @@ void init_mad(void)
ci->memset(&frame, 0, sizeof(struct mad_frame));
ci->memset(&synth, 0, sizeof(struct mad_synth));
+ ci->memset(&sbsample, 0, sizeof(sbsample));
+
#ifdef MPA_SYNTH_ON_COP
frame.sbsample_prev = &sbsample_prev;
+ ci->memset(&sbsample_prev, 0, sizeof(sbsample_prev));
+ synth_running=0;
#else
frame.sbsample_prev = &sbsample;
#endif
@@ -358,10 +361,15 @@ next_track:
ci->yield();
if (ci->stop_codec || ci->new_track)
break;
-
+
if (ci->seek_time) {
int newpos;
+#ifdef MPA_SYNTH_ON_COP
+ /*make sure the synth thread is idle before seeking*/
+ if(synth_running)
+ mad_synth_thread_wait_pcm();
+#endif
samplesdone = ((int64_t)(ci->seek_time-1))*current_frequency/1000;
if (ci->seek_time-1 == 0) {