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
This commit is contained in:
Thomas Martitz 2009-02-23 21:09:30 +00:00
parent 56f4723d19
commit 5e1bab1cd8

View file

@ -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;