1
0
mirror of https://github.com/mgerb/go-discord-bot synced 2026-01-10 17:12:48 +00:00
This commit is contained in:
2018-05-30 19:27:09 -05:00
parent af8448e028
commit 1f9706060a
3 changed files with 87 additions and 1 deletions

36
server/rtp/rtp.go Normal file
View File

@@ -0,0 +1,36 @@
// 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]
}