cleanup example

This commit is contained in:
aler9
2021-09-23 20:07:21 +02:00
parent b9042282ab
commit 13c6b69d30

View File

@@ -39,17 +39,23 @@ func main() {
// read RTP packets // read RTP packets
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) { err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
if streamType == gortsplib.StreamTypeRTP && trackID == h264Track { if streamType != gortsplib.StreamTypeRTP {
// convert RTP packets into H264 NALUs return
nalus, _, err := dec.Decode(payload) }
if err != nil {
return
}
// print NALUs if trackID != h264Track {
for _, nalu := range nalus { return
fmt.Printf("received H264 NALU of size %d\n", len(nalu)) }
}
// convert RTP packets into H264 NALUs
nalus, _, err := dec.Decode(payload)
if err != nil {
return
}
// print NALUs
for _, nalu := range nalus {
fmt.Printf("received H264 NALU of size %d\n", len(nalu))
} }
}) })
panic(err) panic(err)