Fix crash when audio encoder is not initalized.

In some cases, audio encoder is not initalized (as explained in ticket #14298).