[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rockbox-cvs
Subject:    nicolasp: r17875 - trunk/apps
From:       mailer () svn ! rockbox ! org
Date:       2008-06-29 11:50:41
Message-ID: 200806291150.m5TBofVP029426 () giant ! haxx ! se
[Download RAW message or body]

Date: 2008-06-29 13:50:41 +0200 (Sun, 29 Jun 2008)
New Revision: 17875

Log Message:
Fix FS#9110 and its maybe-dupes.
The issue happened when the value of 'filling' was STATE_FINISHED: the \
low_buffer_callback wouldn't do anything even when there would still be data \
remaining to be buffered, leading to a shortage of audio data. Only making the \
callback act even when filling is STATE_FINISHED (the simple fix) isn't right because \
of cases when the last track in the playlist is fully buffered. Therefore I added a \
new state to distinguish between when the last track is fully buffered \
(STATE_FINISHED) and when it isn't (STATE_END_OF_PLAYLIST).


Modified:
   trunk/apps/playback.c

Modified: trunk/apps/playback.c
===================================================================
--- trunk/apps/playback.c	2008-06-29 11:03:12 UTC (rev 17874)
+++ trunk/apps/playback.c	2008-06-29 11:50:41 UTC (rev 17875)
@@ -151,7 +151,8 @@
     STATE_IDLE,     /* audio is stopped: nothing to do */
     STATE_FILLING,  /* adding tracks to the buffer */
     STATE_FULL,     /* can't add any more tracks */
-    STATE_FINISHED, /* all remaining tracks have been added */
+    STATE_END_OF_PLAYLIST, /* all remaining tracks have been added */
+    STATE_FINISHED, /* all remaining tracks are fully buffered */
 };
 
 #if MEM > 1
@@ -1413,7 +1414,7 @@
     (void)data;
     logf("low buffer callback");
 
-    if (filling == STATE_FULL) {
+    if (filling == STATE_FULL || filling == STATE_END_OF_PLAYLIST) {
         /* force a refill */
         LOGFQUEUE("buffering > audio Q_AUDIO_FILL_BUFFER");
         queue_post(&audio_queue, Q_AUDIO_FILL_BUFFER, 0);
@@ -1443,6 +1444,15 @@
         /* This is most likely an audio handle, so we strip the useless
            trailing tags that are left. */
         strip_tags(*data);
+
+        if (*data == tracks[track_widx-1].audio_hid
+            && filling == STATE_END_OF_PLAYLIST)
+        {
+            /* This was the last track in the playlist.
+               We now have all the data we need. */
+            logf("last track finished buffering");
+            filling = STATE_FINISHED;
+        }
     }
 }
 
@@ -1634,7 +1644,7 @@
     {
         logf("End-of-playlist");
         memset(&lasttrack_id3, 0, sizeof(struct mp3entry));
-        filling = STATE_FINISHED;
+        filling = STATE_END_OF_PLAYLIST;
         return false;
     }
 

_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic