Fixed a problem that cpu boost didn't always reset when stopping the
playback.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7153 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index ae8f0c2..eb6c43e 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -312,7 +312,7 @@
     int bytesleft = pcmbuf_unplayed_bytes;
     
     crossfade_init = 0;
-    if (bytesleft < CHUNK_SIZE * 3) {
+    if (bytesleft < CHUNK_SIZE * 4) {
         logf("crossfade rejected");
         pcmbuf_play_stop();
         return ;
@@ -399,7 +399,10 @@
 void* pcmbuf_request_buffer(long length, long *realsize)
 {
     void *ptr = NULL;
-    
+
+    if (crossfade_init)
+        crossfade_start();
+        
     while (audiobuffer_free < length + audiobuffer_fillpos
            + CHUNK_SIZE && !crossfade_active) {
         pcmbuf_boost(false);
diff --git a/apps/playback.c b/apps/playback.c
index 0e20d97..7fbfa6b 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1192,16 +1192,18 @@
 {
     paused = false;
     playing = false;
+    filling = false;
     ci.stop_codec = true;
     if (current_fd >= 0) {
         close(current_fd);
         current_fd = -1;
     }
+    while (codec_loaded)
+        yield();
     pcmbuf_play_stop();
     pcm_play_pause(true);
     track_count = 0;
     audio_clear_track_entries();
-    filling = false;
 }
 
 /* Request the next track with new codec. */