summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2008-04-03 21:40:07 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2008-04-03 21:40:07 +0000
commitfe9eb68ec0e3d5b8b883e8942e3c0f24e44d598f (patch)
tree56ce04ec4fc5cfe622dede91759f0d2df9b87d91
parent6118a54aa29c1782fcc9dc79053bd9f3afdba5a0 (diff)
downloadrockbox-fe9eb68ec0e3d5b8b883e8942e3c0f24e44d598f.tar.gz
rockbox-fe9eb68ec0e3d5b8b883e8942e3c0f24e44d598f.zip
Fix FS#8513 (Playback occasionally repeats a track when rebuffering occurs) and hopefully others by essentially reverting r16019, parts of r16425 and most bugfix followups. This means we're back to having a desynchronized playlist index in the WPS. audio_check_new_track() needs a serious rework before we can make improvements in that area without breaking things.
playlist_checkend() isn't used anymore but I'm not removing it for now because it might prove useful later on. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16955 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 1101517aef..b145823485 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -244,7 +244,6 @@ static enum filling_state filling;
244/* Track change controls */ 244/* Track change controls */
245static bool automatic_skip = false; /* Who initiated in-progress skip? (C/A-) */ 245static bool automatic_skip = false; /* Who initiated in-progress skip? (C/A-) */
246static bool playlist_end = false; /* Has the current playlist ended? (A) */ 246static bool playlist_end = false; /* Has the current playlist ended? (A) */
247static bool auto_dir_skip = false; /* Have we changed dirs automatically? */
248static bool dir_skip = false; /* Is a directory skip pending? (A) */ 247static bool dir_skip = false; /* Is a directory skip pending? (A) */
249static bool new_playlist = false; /* Are we starting a new playlist? (A) */ 248static bool new_playlist = false; /* Are we starting a new playlist? (A) */
250static int wps_offset = 0; /* Pending track change offset, to keep WPS responsive (A) */ 249static int wps_offset = 0; /* Pending track change offset, to keep WPS responsive (A) */
@@ -680,8 +679,6 @@ static void audio_skip(int direction)
680 queue_post(&audio_queue, Q_AUDIO_SKIP, direction); 679 queue_post(&audio_queue, Q_AUDIO_SKIP, direction);
681 /* Update wps while our message travels inside deep playback queues. */ 680 /* Update wps while our message travels inside deep playback queues. */
682 wps_offset += direction; 681 wps_offset += direction;
683 /* Immediately update the playlist index */
684 playlist_next(direction);
685 track_changed = true; 682 track_changed = true;
686 } 683 }
687 else 684 else
@@ -1856,7 +1853,6 @@ static int audio_check_new_track(void)
1856 int old_track_ridx = track_ridx; 1853 int old_track_ridx = track_ridx;
1857 int i, idx; 1854 int i, idx;
1858 bool forward; 1855 bool forward;
1859 bool end_of_playlist; /* Temporary flag, not the same as playlist_end */
1860 1856
1861 /* Now it's good time to send track finish events. */ 1857 /* Now it's good time to send track finish events. */
1862 send_event(PLAYBACK_EVENT_TRACK_FINISH, &curtrack_id3); 1858 send_event(PLAYBACK_EVENT_TRACK_FINISH, &curtrack_id3);
@@ -1879,9 +1875,6 @@ static int audio_check_new_track(void)
1879 if (new_playlist) 1875 if (new_playlist)
1880 ci.new_track = 0; 1876 ci.new_track = 0;
1881 1877
1882 end_of_playlist = !playlist_checkend(automatic_skip ? ci.new_track : 0);
1883 auto_dir_skip = end_of_playlist && global_settings.next_folder;
1884
1885 /* If the playlist isn't that big */ 1878 /* If the playlist isn't that big */
1886 if (automatic_skip) 1879 if (automatic_skip)
1887 { 1880 {
@@ -1899,15 +1892,10 @@ static int audio_check_new_track(void)
1899 /* Update the playlist */ 1892 /* Update the playlist */
1900 last_peek_offset -= ci.new_track; 1893 last_peek_offset -= ci.new_track;
1901 1894
1902 if (auto_dir_skip) 1895 if (playlist_next(ci.new_track) < 0)
1903 { 1896 {
1904 /* If the track change was the result of an auto dir skip, 1897 LOGFQUEUE("audio >|= codec Q_CODEC_REQUEST_FAILED");
1905 we need to update the playlist now */ 1898 return Q_CODEC_REQUEST_FAILED;
1906 if (playlist_next(ci.new_track) < 0)
1907 {
1908 LOGFQUEUE("audio >|= codec Q_CODEC_REQUEST_FAILED");
1909 return Q_CODEC_REQUEST_FAILED;
1910 }
1911 } 1899 }
1912 1900
1913 if (new_playlist) 1901 if (new_playlist)
@@ -2203,15 +2191,10 @@ static void audio_finalise_track_change(void)
2203 2191
2204 if (automatic_skip) 2192 if (automatic_skip)
2205 { 2193 {
2206 if (!auto_dir_skip)
2207 playlist_next(-wps_offset);
2208
2209 wps_offset = 0; 2194 wps_offset = 0;
2210 automatic_skip = false; 2195 automatic_skip = false;
2211 } 2196 }
2212 2197
2213 auto_dir_skip = false;
2214
2215 /* Invalidate prevtrack_id3 */ 2198 /* Invalidate prevtrack_id3 */
2216 prevtrack_id3.path[0] = 0; 2199 prevtrack_id3.path[0] = 0;
2217 2200