add minimum buffer size (same to #854)

to make sure there is macroblock size length left at the end of the buffer when the targeted buffer size is small