avcodec: check i_samples_delay before rewinding date
avcodec: refactor delay buffer handling from EncodeAudio
avcodec: refactor audio encoding
avcodec: increment frame->nb_samples, just in case
avcodec: give right buffer size not the smallest one