Merge "Cleaning up encode_frame_internal()."