encode_voice_data

Function encode_voice_data 

Source
pub fn encode_voice_data(
    out: &mut [u8],
    stream_id: StreamId,
    seq: u8,
    frame: &VoiceFrame,
) -> Result<usize, EncodeError>
Expand description

Encode a 29-byte voice data packet.

Layout per ircDDBGateway/Common/AMBEData.cpp:347-388 (getDPlusData else branch):

  • [0] 0x1D (length byte)
  • [1] 0x80 (type byte)
  • [2..6] “DSVT”
  • [6] 0x20 (voice type)
  • [7..10] 0x00 (reserved)
  • [10] 0x20 (config)
  • [11..14] 0x00 0x01 0x02 (bands)
  • [14..16] stream_id LE
  • [16] seq
  • [17..26] 9 AMBE bytes
  • [26..29] 3 slow data bytes

§Errors

Returns EncodeError::BufferTooSmall if out.len() < 29.

§See also

ircDDBGateway/Common/AMBEData.cpp:347-388 (getDPlusData) for the reference encoder, and xlxd/src/cdplusprotocol.cpp for a mirror implementation.