Documentation
¶
Index ¶
Constants ¶
const ( CodecCELTAlpha = 0 CodecSpeex = 2 // Deprecated CodecCELTBeta = 3 CodecOpus = 4 // Preferred )
Codec IDs for Mumble audio. See docs/protocol/voice-data.md.
const MaxVarintLen = 10
MaxVarintLen is the maximum number of bytes required to encode a Mumble varint.
Variables ¶
var ErrPacketTooShort = errors.New("audio: packet too short")
ErrPacketTooShort is returned when the packet buffer is too short to parse.
Functions ¶
func DecodeVarint ¶
Decode reads the first varint-encoded number from the given buffer. Returns the value and the number of bytes read. Returns 0 bytes read on error.
func EncodeVarint ¶
EncodeVarint encodes the given value in Mumble varint format. Returns the number of bytes written. Caller must ensure b has sufficient space (MaxVarintLen for safety).
Types ¶
type ParsedPacket ¶
type ParsedPacket struct {
Codec uint8 // Audio codec ID (bits 7-5 of header)
Target uint8 // Voice target (bits 4-0 of header)
Sequence int64 // Sequence number
PayloadLen int64 // Payload length in bytes (bit 13 masked out)
IsTerminator bool // True if bit 13 of payload length varint was set
Payload []byte // Audio frame data
}
ParsedPacket is the result of parsing a client-to-server legacy binary audio packet.
func ParsePacket ¶
func ParsePacket(data []byte) (*ParsedPacket, error)
ParsePacket parses a client-to-server legacy binary UDP audio packet. The server receives these from clients; no session field is present. See docs/protocol/voice-data.md.