diff --git a/examples/client-publish-options/main.go b/examples/client-publish-options/main.go index 9844f241..05048834 100644 --- a/examples/client-publish-options/main.go +++ b/examples/client-publish-options/main.go @@ -61,13 +61,13 @@ func main() { buf := make([]byte, 2048) for { - // read frames from the source + // read RTP frames from the source n, _, err := pc.ReadFrom(buf) if err != nil { panic(err) } - // write track frames + // write RTP frames err = conn.WriteFrame(track.ID, gortsplib.StreamTypeRTP, buf[:n]) if err != nil { panic(err) diff --git a/examples/client-publish-pause/main.go b/examples/client-publish-pause/main.go index 46b64bb9..f97dad21 100644 --- a/examples/client-publish-pause/main.go +++ b/examples/client-publish-pause/main.go @@ -57,13 +57,13 @@ func main() { buf := make([]byte, 2048) for { - // read frames from the source + // read RTP frames from the source n, _, err := pc.ReadFrom(buf) if err != nil { break } - // write track frames + // write RTP frames err = conn.WriteFrame(track.ID, gortsplib.StreamTypeRTP, buf[:n]) if err != nil { break diff --git a/examples/client-publish/main.go b/examples/client-publish/main.go index 11a32cdf..503c277c 100644 --- a/examples/client-publish/main.go +++ b/examples/client-publish/main.go @@ -49,13 +49,13 @@ func main() { buf := make([]byte, 2048) for { - // read frames from the source + // read RTP frames from the source n, _, err := pc.ReadFrom(buf) if err != nil { panic(err) } - // write track frames + // write RTP frames err = conn.WriteFrame(track.ID, gortsplib.StreamTypeRTP, buf[:n]) if err != nil { panic(err) diff --git a/examples/client-read-h264/main.go b/examples/client-read-h264/main.go index 7323abc1..e10eac4a 100644 --- a/examples/client-read-h264/main.go +++ b/examples/client-read-h264/main.go @@ -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)) } diff --git a/examples/client-read-options/main.go b/examples/client-read-options/main.go index e29fd2da..ec1fd0a9 100644 --- a/examples/client-read-options/main.go +++ b/examples/client-read-options/main.go @@ -29,7 +29,7 @@ func main() { } defer conn.Close() - // read track frames + // read RTP frames err = <-conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) { fmt.Printf("frame from track %d, type %v, size %d\n", trackID, typ, len(buf)) }) diff --git a/examples/client-read-partial/main.go b/examples/client-read-partial/main.go index 27dcc059..618eae96 100644 --- a/examples/client-read-partial/main.go +++ b/examples/client-read-partial/main.go @@ -35,8 +35,8 @@ func main() { panic(err) } + // start reading only video tracks, skipping audio or application tracks for _, t := range tracks { - // start reading only video tracks, skipping audio or application tracks if t.Media.MediaName.Media == "video" { _, err := conn.Setup(headers.TransportModePlay, t, 0, 0) if err != nil { @@ -45,12 +45,13 @@ func main() { } } + // play setupped tracks _, err = conn.Play() if err != nil { panic(err) } - // read track frames + // read RTP frames err = <-conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) { fmt.Printf("frame from track %d, type %v, size %d\n", trackID, typ, len(buf)) }) diff --git a/examples/client-read-pause/main.go b/examples/client-read-pause/main.go index c69da2f6..23f84ee2 100644 --- a/examples/client-read-pause/main.go +++ b/examples/client-read-pause/main.go @@ -22,7 +22,7 @@ func main() { defer conn.Close() for { - // read track frames + // read RTP frames done := conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) { fmt.Printf("frame from track %d, type %v, size %d\n", trackID, typ, len(buf)) }) diff --git a/examples/client-read/main.go b/examples/client-read/main.go index 6e3ba648..f904e49c 100644 --- a/examples/client-read/main.go +++ b/examples/client-read/main.go @@ -17,7 +17,7 @@ func main() { } defer conn.Close() - // read track frames + // read RTP frames err = <-conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) { fmt.Printf("frame from track %d, type %v, size %d\n", trackID, typ, len(buf)) })