anim_encode: Fix encoded_frames_[] overflow
anim_encode: Fix encoded_frames_[] overflow

Check encoded_frames_ count and call FlushFrames if necessary after
IncreasePreviousDuration. Avoids an overflow in encoded_frames_[] with
-kmax 0 and an assertion failure related to the previous and keyframe
durations when a frame is forced in this way.

Based on patch by tomwei7g <at> gmail

Bug: webp:518
Change-Id: Idef685e6c06a67d48fcdc048265ca0e672a01263

webmproject/libwebp,webmproject/libwebp,webmproject/libwebp,PKRoma/libwebp,webmproject/libwebp,PKRoma/libwebp,PKRoma/libwebp,PKRoma/libwebp,webmproject/libwebp,PKRoma/libwebp,PKRoma/libwebp