mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-10 17:12:48 +00:00
wip
This commit is contained in:
36
server/rtp/rtp.go
Normal file
36
server/rtp/rtp.go
Normal 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]
|
||||
}
|
||||
Reference in New Issue
Block a user