1
0
Fork 0
mirror of https://github.com/owncast/owncast.git synced 2024-12-22 17:20:37 +03:00
owncast/core/rtmp/broadcaster.go
2021-05-24 21:43:13 -07:00

34 lines
905 B
Go

package rtmp
import (
"time"
"github.com/nareix/joy5/format/flv/flvio"
"github.com/owncast/owncast/models"
log "github.com/sirupsen/logrus"
)
func setCurrentBroadcasterInfo(t flvio.Tag, remoteAddr string) {
data, err := getInboundDetailsFromMetadata(t.DebugFields())
if err != nil {
log.Traceln("Unable to parse inbound broadcaster details:", err)
}
broadcaster := models.Broadcaster{
RemoteAddr: remoteAddr,
Time: time.Now(),
StreamDetails: models.InboundStreamDetails{
Width: data.Width,
Height: data.Height,
VideoBitrate: int(data.VideoBitrate),
VideoCodec: getVideoCodec(data.VideoCodec),
VideoFramerate: data.VideoFramerate,
AudioBitrate: int(data.AudioBitrate),
AudioCodec: getAudioCodec(data.AudioCodec),
Encoder: data.Encoder,
VideoOnly: data.AudioCodec == nil,
},
}
_setBroadcaster(broadcaster)
}