improve example comments

This commit is contained in:
aler9
2021-04-04 19:43:48 +02:00
parent fc3d84be56
commit c2d5ced43b
8 changed files with 15 additions and 12 deletions

View File

@@ -37,14 +37,16 @@ func main() {
// instantiate a decoder
dec := rtph264.NewDecoder()
// get H264 NALUs of that track
// read RTP frames
err = <-conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) {
if trackID == h264Track {
// convert RTP frames into H264 NALUs
nts, err := dec.Decode(buf)
if err != nil {
return
}
// print NALUs
for _, nt := range nts {
fmt.Printf("received H264 NALU of size %d\n", len(nt.NALU))
}