All Downloads are FREE. Search and download functionalities are using the official Maven repository.

vendor.github.com.pion.rtp.codecs.opus_packet.go Maven / Gradle / Ivy

There is a newer version: 2.9.1
Show newest version
package codecs

// OpusPayloader payloads Opus packets
type OpusPayloader struct{}

// Payload fragments an Opus packet across one or more byte arrays
func (p *OpusPayloader) Payload(mtu uint16, payload []byte) [][]byte {
	if payload == nil {
		return [][]byte{}
	}

	out := make([]byte, len(payload))
	copy(out, payload)
	return [][]byte{out}
}

// OpusPacket represents the Opus header that is stored in the payload of an RTP Packet
type OpusPacket struct {
	Payload []byte

	audioDepacketizer
}

// Unmarshal parses the passed byte slice and stores the result in the OpusPacket this method is called upon
func (p *OpusPacket) Unmarshal(packet []byte) ([]byte, error) {
	if packet == nil {
		return nil, errNilPacket
	} else if len(packet) == 0 {
		return nil, errShortPacket
	}

	p.Payload = packet
	return packet, nil
}

// OpusPartitionHeadChecker is obsolete
type OpusPartitionHeadChecker struct{}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy