Retool decoder loop to handle multiple packets per page properly

This was causing two problems, it looks like:
* progressive slowdown in IE (due to stuffing packets into a growing buffer triggering slow memcpy operations on realloc)
* early end of file