akode: crash with jack, buggy playback after first crash gone
akode is one of the few remaining frameworks that still have a working
jack support and also have the capability to use libsamplerate for
performing high-quality audio resampling. That is excellent, but
unfortunately it doesn't work at all.
Firstly, akode consistently crashed on a double free error. This was
most likely due to audioframe.h which did not allocate enough memory to
hold floating point values. This bug went away if I replaced the bytes
calculation with a static bytes=4 assignment, so the sample format must
be errorneouslly overwritten somewhere, I guess.
Unfortunately fixing that still wasn't enough to make akode and jack
cooperate. After this, akode doesn't outright crash, but the playback is
very nasty high-pitched noise, possibly due to some kind of type error
(treating floating point -formatted memory as integers or vice versa,
maybe). My hunch would be that the part causing the bits overwrite must
be responsible for that as well. I don't where this occurs, though. At
least resampling library seems to be clear of blame, because the output
is distorted with or without resampling being used.
Finally, there is some issue in freeing the jack device. If I press stop
on a player that uses akode, such as juk, the audio doesn't stop but
jack ends up looping the last sample fragment (which is very nasty noise
due to the previous bug) and trying to play next song only provides an
juk: WARNING: Unable to play <song>
JACK expects that if playback is paused or akode runs out of data to
play, the jack write buffer should nevertheless be cleared. I don't know
how easy this is to arrange, but I think a small hack in akode could
make it work like OSS or ALSA, where it's valid to just stop writing
when there's nothing more to play. In summary, clearly not many people
are using the jack parts of akode. JACK version is 0.100. The system is
native amd64. I had to compile akode myself because Ubuntu has opted to
not compile jack support in the media frameworks. :-(
Can anything be done about these issues?