toAnnexB

fun toAnnexB(payload: ByteArray, nalLengthSize: Int): ByteArray?

Rewrites length-prefixed NAL units with four-byte start codes.

Existing Annex B storage is returned without copying. Null means the packet is malformed or nalLengthSize is not one, two, or four bytes.