The encoder deliberately enforces only what the byte layout itself needs (u16 packet lengths,
header consistency); the Opus packet-size ceiling is enforced by ParseRecordingShard,
the trust boundary where untrusted bytes arrive.
RecordingShardFormatError when PacketCount disagrees with Packets, a header field is
out of range, or a packet length cannot be stored in a u16 (or is zero).
Serializes a shard to MJOPUS1 bytes.
The encoder deliberately enforces only what the byte layout itself needs (u16 packet lengths, header consistency); the Opus packet-size ceiling is enforced by ParseRecordingShard, the trust boundary where untrusted bytes arrive.