package voice

// Packet represents a voice packet
type Packet struct {
	SourceUserID  string
	ChannelID     string
	SequenceNum   uint32
	Timestamp     uint32
	SSRC          uint32
	Payload       []byte
	ClientTime    int64
}

// NewPacket creates a new voice packet
func NewPacket(sourceUserID, channelID string, seqNum, timestamp, ssrc uint32, payload []byte, clientTime int64) *Packet {
	return &Packet{
		SourceUserID: sourceUserID,
		ChannelID:    channelID,
		SequenceNum:  seqNum,
		Timestamp:    timestamp,
		SSRC:         ssrc,
		Payload:      payload,
		ClientTime:   clientTime,
	}
}

// Size returns the size of the packet payload
func (p *Packet) Size() int {
	if p.Payload == nil {
		return 0
	}
	return len(p.Payload)
}
