Fix uninitialized sz field for stream info; pre allocate output buffer in main thread. More stable.