The problem is most likely a bug in the patches.
Unless you can confirm this with an official build, there's no point in discussing it here. A situation such as you have described would in essence be impossible to cause with the official build, but I don't know what'd happen if you modified Rockbox to the extent where it could happen.
Besides, I already told you how you can *check* how much codec buffer is left. You can confirm if a very small codec buffer is even happening by just looking.