0

Add verbose logging for RTMP metadata

This commit is contained in:
Gabe Kangas 2020-07-13 23:32:35 -07:00
parent 4559bde977
commit dd1b9411bf
3 changed files with 10 additions and 13 deletions

View File

@ -10,8 +10,8 @@ import (
"time"
"unsafe"
"github.com/nareix/joy5/av"
"github.com/nareix/joy5/format/flv"
"github.com/nareix/joy5/format/flv/flvio"
log "github.com/sirupsen/logrus"
"github.com/gabek/owncast/config"
@ -62,6 +62,13 @@ func Start() {
}
func HandleConn(c *rtmp.Conn, nc net.Conn) {
c.LogTagEvent = func(isRead bool, t flvio.Tag) {
if t.Type == flvio.TAG_AMF0 {
log.Infof("%+v\n", t.DebugFields())
}
}
if _isConnected {
log.Errorln("stream already running; can not overtake an existing stream")
nc.Close()
@ -102,17 +109,10 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) {
return
}
if pkt.Type == av.Metadata {
log.Traceln(string(pkt.Data))
if pkt.Metadata != nil {
fmt.Println(string(pkt.Metadata))
}
// if pkt.Type == av.H264 {
// nalus, _ := h264.SplitNALUs(pkt.Data)
// annexb := h264.JoinNALUsAnnexb(nalus)
// avcc := h264.JoinNALUsAVCC([][]byte{annexb})
// pkt.Data = avcc
// }
if err := w.WritePacket(pkt); err != nil {
panic(err)
}

1
go.mod
View File

@ -8,7 +8,6 @@ require (
github.com/ipfs/go-ipfs-config v0.5.3
github.com/ipfs/go-ipfs-files v0.0.8
github.com/ipfs/interface-go-ipfs-core v0.2.7
github.com/karalabe/xgo v0.0.0-20191115072854-c5ccff8648a7 // indirect
github.com/libp2p/go-libp2p-peer v0.2.0
github.com/libp2p/go-libp2p-peerstore v0.2.6
github.com/mattn/go-sqlite3 v1.14.0

2
go.sum
View File

@ -415,8 +415,6 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
github.com/karalabe/xgo v0.0.0-20191115072854-c5ccff8648a7 h1:AYzjK/SHz6m6mg5iuFwkrAhCc14jvCpW9d6frC9iDPE=
github.com/karalabe/xgo v0.0.0-20191115072854-c5ccff8648a7/go.mod h1:iYGcTYIPUvEWhFo6aKUuLchs+AV4ssYdyuBbQJZGcBk=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
github.com/kisielk/errcheck v1.2.0 h1:reN85Pxc5larApoH1keMBiu2GWtPqXQ1nc9gx+jOU+E=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=