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 27-byte voice data packet.

Layout per ircDDBGateway/Common/AMBEData.cpp:317-345 (getDExtraData):

  • [0..4]: b"DSVT"
  • [4]: 0x20 (voice type)
  • [5..8]: 0x00 (reserved)
  • [8]: 0x20 (config)
  • [9..12]: 0x00 0x01 0x02 (bands)
  • [12..14]: stream_id LE
  • [14]: seq
  • [15..24]: 9 AMBE bytes
  • [24..27]: 3 slow data bytes

§Errors

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

§See also

ircDDBGateway/Common/AMBEData.cpp:317-345 (getDExtraData) for the reference encoder this function mirrors.