Rockbox mail archiveSubject: [HELP] playback / buffering
[HELP] playback / buffering
From: Rafaël Carré <rafael.carre_at_gmail.com>
Date: Fri, 26 Jun 2009 10:29:11 +0200
I'm reading playback.c and buffering.c to find what is wrong with the
Clip/c200v2/m200v4 (targets with quite small audiobuffer).
I have already identified a problem related to album art (on the color
audio_finish_load_track() in playback.c returns early because album art
couldn't be loaded (bofopen() returns ERR_BUFFER_FULL).
This causes an infinite loop : buffering_thread() keeps sending a
BUFFER_LOW event and playback.c's buffering_low_buffer_callback() will
have no effect since filling is STATE_FILLING.
If AA couldn't be loaded because of another error, the function
continues loading the codec. This behaviour was introduced by Toni in
r20149 "Bugfix: If AlbumArt bitmap loading fails, dont try loading it
over and over again, but simply ignore AlbumArt in this case."
Repeating the change from r20149 "works for me" in the sense that the
song starts playing without album art.
However I feel like this change was not correct in the first place:
audio_finish_load_track() will return in several other cases, commented
as "buffer is full, not an error".
Some of these comments have been committed by kugel in r20093, which
also handled specifically cases where the buffer is full.
If it's not an error I assume this function will be called again when
some buffer will have been consumed by playing back the current song
but this doesn't seem to be the case : audio_finish_load_track() is
only called on Q_AUDIO_FINISH_LOAD event, itself only called on
BUFFER_EVENT_FINISHED event (which means the current song has been
There is something wrong there but I just can't figure what:
- Is rockbox meant to infinitely (or perhaps in a clever manner) retry
loading a track until there is enough buffer available?
- If the buffer is full when attempting to load album art or a codec
handle, is that an unrecoverable error?
This code is a bit complex for me, and I hope someone could enlight me.
Perhaps playback.c is something no one understands anymore? (644
-- Rafaël Carré