From 5e1bab1cd85135a9d666fd278ecc9bf010a67bc8 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 23 Feb 2009 21:09:30 +0000 Subject: Fix two rare bugs which caused playback to not unboost. The filling state was not set properly, if there was no space left for the handle for albumart or audio data. but for the handle for metadata. This also adds specific checks for ERR_BUFFER_FULL and appropriate logf messages. This also appears to fix the constant boosting part of FS#8999 (at least I couldn't reproduce). It does certainly not fix that buffering is stucked. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20093 a1c6a512-1295-4272-9138-f99709370657 --- apps/playback.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'apps/playback.c') diff --git a/apps/playback.c b/apps/playback.c index 3d22b90bf5..156723ce51 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -1727,7 +1727,7 @@ static bool audio_load_track(size_t offset, bool start_play) { tracks[track_widx].id3_hid = bufopen(trackname, 0, TYPE_ID3); - if (tracks[track_widx].id3_hid < 0) + if (tracks[track_widx].id3_hid == ERR_BUFFER_FULL) { /* Buffer is full. */ get_metadata(&lasttrack_id3, fd, trackname); @@ -1737,6 +1737,13 @@ static bool audio_load_track(size_t offset, bool start_play) filling = STATE_FULL; return false; } + else if (tracks[track_widx].id3_hid < 0) + { + last_peek_offset--; + close(fd); + logf("Could not add metadata handle"); + return false; + } if (track_widx == track_ridx) { @@ -1809,7 +1816,17 @@ static void audio_finish_load_track(void) tracks[track_widx].aa_hid = bufopen(aa_path, 0, TYPE_BITMAP); if(tracks[track_widx].aa_hid == ERR_BUFFER_FULL) + { + filling = STATE_FULL; + logf("buffer is full for now"); return; /* No space for track's album art, not an error */ + } + else if (tracks[track_widx].aa_hid < 0) + { + /* another error, do not continue either */ + logf("Could not add album art handle"); + return; + } } } #endif @@ -1887,8 +1904,19 @@ static void audio_finish_load_track(void) tracks[track_widx].audio_hid = bufopen(track_id3->path, file_offset, type); - if (tracks[track_widx].audio_hid < 0) + /* No space left, not an error */ + if (tracks[track_widx].audio_hid == ERR_BUFFER_FULL) + { + filling = STATE_FULL; + logf("buffer is full for now"); return; + } + else if (tracks[track_widx].audio_hid < 0) + { + /* another error, do not continue either */ + logf("Could not add audio data handle"); + return; + } /* All required data is now available for the codec. */ tracks[track_widx].taginfo_ready = true; -- cgit v1.2.3