Bug 863929: Fix codec list loop exit calculation r=ehugg