summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playback.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 9c8f89127c..aa4471ab33 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -925,20 +925,24 @@ static void audio_rebuffer(void)
925 queue_post(&codec_callback_queue, Q_CODEC_REQUEST_PENDING, 0); 925 queue_post(&codec_callback_queue, Q_CODEC_REQUEST_PENDING, 0);
926 926
927 /* Stop in progress fill, and clear open file descriptor */ 927 /* Stop in progress fill, and clear open file descriptor */
928 close(current_fd); 928 if (current_fd >= 0)
929 current_fd = -1; 929 {
930 close(current_fd);
931 current_fd = -1;
932 }
930 filling = false; 933 filling = false;
931 934
932 /* Reset buffer and track pointers */ 935 /* Reset buffer and track pointers */
933 buf_ridx = buf_widx = 0; 936 buf_ridx = buf_widx = 0;
934 track_widx = track_ridx = 0; 937 track_widx = track_ridx;
935 audio_clear_track_entries(false, true); 938 audio_clear_track_entries(true, true);
936 filebufused = 0; 939 filebufused = 0;
937 940
938 /* Fill the buffer */ 941 /* Fill the buffer */
939 last_peek_offset = -1; 942 last_peek_offset = -1;
940 cur_ti->filesize = 0; 943 cur_ti->filesize = 0;
941 cur_ti->start_pos = 0; 944 cur_ti->start_pos = 0;
945 ci.curpos = 0;
942 946
943 if (!cur_ti->taginfo_ready) 947 if (!cur_ti->taginfo_ready)
944 memset(&cur_ti->id3, 0, sizeof(struct mp3entry)); 948 memset(&cur_ti->id3, 0, sizeof(struct mp3entry));
@@ -2124,7 +2128,8 @@ static void track_skip_done(bool was_manual)
2124 } 2128 }
2125} 2129}
2126 2130
2127static bool load_next_track(void) { 2131static bool load_next_track(void)
2132{
2128 struct event ev; 2133 struct event ev;
2129 2134
2130 if (ci.seek_time) 2135 if (ci.seek_time)
@@ -2144,7 +2149,8 @@ static bool load_next_track(void) {
2144 2149
2145 cpu_boost(true); 2150 cpu_boost(true);
2146 queue_post(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 0); 2151 queue_post(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 0);
2147 while (1) { 2152 while (1)
2153 {
2148 queue_wait(&codec_callback_queue, &ev); 2154 queue_wait(&codec_callback_queue, &ev);
2149 if (ev.id == Q_CODEC_REQUEST_PENDING) 2155 if (ev.id == Q_CODEC_REQUEST_PENDING)
2150 { 2156 {