1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-10 09:02:49 +00:00
Files
go-discord-bot/server/rtp/rtp.go
2018-05-30 19:27:09 -05:00

37 lines
569 B
Go

// rtp packet processing
package rtp
import (
"time"
"github.com/bwmarrin/discordgo"
)
// RTP -
type RTP struct {
StartTime time.Time
Streams map[uint32]*Stream
}
// New -
func New() *RTP {
return &RTP{
StartTime: time.Now(),
Streams: map[uint32]*Stream{},
}
}
// PushPacket -
func (r *RTP) PushPacket(packet *discordgo.Packet) {
if _, ok := r.Streams[packet.SSRC]; !ok {
r.Streams[packet.SSRC] = new(Stream)
}
r.Streams[packet.SSRC].PushPacket(packet)
}
// GetStream -
func (r *RTP) GetStream(ssrc uint32) *Stream {
return r.Streams[ssrc]
}