From b405b2fcc7f1c7fd0429e56ddbcaa37f4bd5cd74 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 6 Dec 2020 14:28:00 -0800 Subject: [PATCH] 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 --- core/rtmp/broadcaster.go | 3 +-- core/rtmp/rtmp.go | 2 +- core/rtmp/utils.go | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/rtmp/broadcaster.go b/core/rtmp/broadcaster.go index e56bf456a..25b600166 100644 --- a/core/rtmp/broadcaster.go +++ b/core/rtmp/broadcaster.go @@ -11,8 +11,7 @@ import ( func setCurrentBroadcasterInfo(t flvio.Tag, remoteAddr string) { data, err := getInboundDetailsFromMetadata(t.DebugFields()) if err != nil { - log.Errorln(err) - return + log.Traceln("RTMP meadata:", err) } broadcaster := models.Broadcaster{ diff --git a/core/rtmp/rtmp.go b/core/rtmp/rtmp.go index 387015f3b..648834def 100644 --- a/core/rtmp/rtmp.go +++ b/core/rtmp/rtmp.go @@ -70,7 +70,6 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) { if t.Type == flvio.TAG_AMF0 { log.Tracef("%+v\n", t.DebugFields()) setCurrentBroadcasterInfo(t, nc.RemoteAddr().String()) - _setStreamAsConnected() } } @@ -89,6 +88,7 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) { } log.Infoln("Incoming RTMP connected.") + _setStreamAsConnected() pipePath := utils.GetTemporaryPipePath() if !utils.DoesFileExists(pipePath) { diff --git a/core/rtmp/utils.go b/core/rtmp/utils.go index 42fb5ee50..7365503af 100644 --- a/core/rtmp/utils.go +++ b/core/rtmp/utils.go @@ -54,6 +54,10 @@ func getAudioCodec(codec interface{}) string { } func getVideoCodec(codec interface{}) string { + if codec == nil { + return "Unknown" + } + var codecID float64 if assertedCodecID, ok := codec.(float64); ok { codecID = assertedCodecID