diff --git a/pkg/h264/avc.go b/pkg/h264/avc.go index fcad70d8..e4844d8b 100644 --- a/pkg/h264/avc.go +++ b/pkg/h264/avc.go @@ -60,3 +60,18 @@ func SplitAVC(data []byte) [][]byte { } return nals } + +func Types(data []byte) []byte { + var types []byte + for { + types = append(types, NALUType(data)) + + size := 4 + int(binary.BigEndian.Uint32(data)) + if size < len(data) { + data = data[size:] + } else { + break + } + } + return types +} diff --git a/pkg/h264/rtp.go b/pkg/h264/rtp.go index f8eef2dd..e1384333 100644 --- a/pkg/h264/rtp.go +++ b/pkg/h264/rtp.go @@ -42,6 +42,8 @@ func RTPDepay(track *streamer.Track) streamer.WrapperFunc { buffer = nil } + //fmt.Printf("[AVC] %v, len: %d\n", Types(payload), len(payload)) + switch NALUType(payload) { case NALUTypeIFrame: payload = Join(ps, payload)