Fix some off by one errors: CID 90494, CID 90483, CID 90485,
Refactor mp2 encoding and let avresample handle the buffering