update examples

This commit is contained in:
aler9
2021-11-01 10:36:45 +01:00
parent a59f840d81
commit 7e978595b5
11 changed files with 15 additions and 15 deletions

View File

@@ -49,7 +49,7 @@ func main() {
buf = make([]byte, 2048)
for {
// read RTP packets from the source
// read packets from the source
n, _, err := pc.ReadFrom(buf)
if err != nil {
panic(err)

View File

@@ -50,7 +50,7 @@ func main() {
buf := make([]byte, 2048)
for {
// read RTP packets from the source
// read packets from the source
n, _, err := pc.ReadFrom(buf)
if err != nil {
panic(err)

View File

@@ -61,7 +61,7 @@ func main() {
buf := make([]byte, 2048)
for {
// read RTP packets from the source
// read packets from the source
n, _, err := pc.ReadFrom(buf)
if err != nil {
panic(err)

View File

@@ -49,7 +49,7 @@ func main() {
buf = make([]byte, 2048)
for {
// read RTP packets from the source
// read packets from the source
n, _, err := pc.ReadFrom(buf)
if err != nil {
panic(err)

View File

@@ -57,7 +57,7 @@ func main() {
buf := make([]byte, 2048)
for {
// read RTP packets from the source
// read packets from the source
n, _, err := pc.ReadFrom(buf)
if err != nil {
break

View File

@@ -71,7 +71,7 @@ func main() {
})
mux.SetPCRPID(256)
// read RTP packets
// read packets
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
if trackID != h264TrackID {
return

View File

@@ -38,7 +38,7 @@ func main() {
// instantiate a RTP/H264 decoder
dec := rtph264.NewDecoder()
// read RTP packets
// read packets
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
if streamType != gortsplib.StreamTypeRTP {
return

View File

@@ -29,9 +29,9 @@ func main() {
}
defer conn.Close()
// read RTP packets
// read packets
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
fmt.Printf("frame from track %d, type %v, size %d\n", trackID, streamType, len(payload))
fmt.Printf("packet from track %d, type %v, size %d\n", trackID, streamType, len(payload))
})
panic(err)
}

View File

@@ -51,9 +51,9 @@ func main() {
panic(err)
}
// read RTP packets
// read packets
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
fmt.Printf("frame from track %d, type %v, size %d\n", trackID, streamType, len(payload))
fmt.Printf("packet from track %d, type %v, size %d\n", trackID, streamType, len(payload))
})
panic(err)
}

View File

@@ -22,12 +22,12 @@ func main() {
defer conn.Close()
for {
// read RTP packets
// read packets
done := make(chan struct{})
go func() {
defer close(done)
conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
fmt.Printf("frame from track %d, type %v, size %d\n", trackID, streamType, len(payload))
fmt.Printf("packet from track %d, type %v, size %d\n", trackID, streamType, len(payload))
})
}()

View File

@@ -17,9 +17,9 @@ func main() {
}
defer conn.Close()
// read RTP packets
// read packets
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
fmt.Printf("frame from track %d, type %v, size %d\n", trackID, streamType, len(payload))
fmt.Printf("packet from track %d, type %v, size %d\n", trackID, streamType, len(payload))
})
panic(err)
}