Add checks for allocation failures

Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
Set sync point for forced keyframes in encoder

Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>