In some cases it's useful to force a flush of the current output buffer. The code is borrowed from the hlsenc.c