0
This commit is contained in:
Gabe Kangas 2020-07-11 23:54:10 -07:00
parent 2bd016ae15
commit c553637521

View File

@ -18,7 +18,6 @@ import (
"github.com/gabek/owncast/core" "github.com/gabek/owncast/core"
"github.com/gabek/owncast/core/ffmpeg" "github.com/gabek/owncast/core/ffmpeg"
"github.com/gabek/owncast/utils" "github.com/gabek/owncast/utils"
"github.com/nareix/joy5/codec/h264"
"github.com/nareix/joy5/format/rtmp" "github.com/nareix/joy5/format/rtmp"
) )
@ -98,21 +97,22 @@ func HandleConn(c *rtmp.Conn, nc net.Conn) {
for { for {
pkt, err := c.ReadPacket() pkt, err := c.ReadPacket()
if err != nil { if err == io.EOF {
if err == io.EOF { handleDisconnect(nc)
handleDisconnect(nc) return
}
} }
if pkt.Type == av.H264 { if pkt.Type == av.Metadata {
nalus, _ := h264.SplitNALUs(pkt.Data)
annexb := h264.JoinNALUsAnnexb(nalus)
avcc := h264.JoinNALUsAVCC([][]byte{annexb})
pkt.Data = avcc
} else if pkt.Type == av.Metadata {
log.Traceln(string(pkt.Data)) log.Traceln(string(pkt.Data))
} }
// 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 { if err := w.WritePacket(pkt); err != nil {
panic(err) panic(err)
} }