Connections from Restream seem to be more sensitive about if we get the initial packets processed or not, so I moved setStreamAsConnected to be decoupled from when we set broadcaster info. Another update for #432

This commit is contained in:
Gabe Kangas 2020-12-06 14:28:00 -08:00
parent 1c42bf9f63
commit b405b2fcc7
3 changed files with 6 additions and 3 deletions

View file

@ -11,8 +11,7 @@ import (
func setCurrentBroadcasterInfo(t flvio.Tag, remoteAddr string) { func setCurrentBroadcasterInfo(t flvio.Tag, remoteAddr string) {
data, err := getInboundDetailsFromMetadata(t.DebugFields()) data, err := getInboundDetailsFromMetadata(t.DebugFields())
if err != nil { if err != nil {
log.Errorln(err) log.Traceln("RTMP meadata:", err)
return
} }
broadcaster := models.Broadcaster{ broadcaster := models.Broadcaster{

View file

@ -70,7 +70,6 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) {
if t.Type == flvio.TAG_AMF0 { if t.Type == flvio.TAG_AMF0 {
log.Tracef("%+v\n", t.DebugFields()) log.Tracef("%+v\n", t.DebugFields())
setCurrentBroadcasterInfo(t, nc.RemoteAddr().String()) setCurrentBroadcasterInfo(t, nc.RemoteAddr().String())
_setStreamAsConnected()
} }
} }
@ -89,6 +88,7 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) {
} }
log.Infoln("Incoming RTMP connected.") log.Infoln("Incoming RTMP connected.")
_setStreamAsConnected()
pipePath := utils.GetTemporaryPipePath() pipePath := utils.GetTemporaryPipePath()
if !utils.DoesFileExists(pipePath) { if !utils.DoesFileExists(pipePath) {

View file

@ -54,6 +54,10 @@ func getAudioCodec(codec interface{}) string {
} }
func getVideoCodec(codec interface{}) string { func getVideoCodec(codec interface{}) string {
if codec == nil {
return "Unknown"
}
var codecID float64 var codecID float64
if assertedCodecID, ok := codec.(float64); ok { if assertedCodecID, ok := codec.(float64); ok {
codecID = assertedCodecID codecID = assertedCodecID