client: remove channel from ReadFrames()

This commit is contained in:
aler9
2021-05-10 17:37:27 +02:00
parent 510bcfe2d7
commit 5eb82448a7
8 changed files with 104 additions and 65 deletions

View File

@@ -23,9 +23,13 @@ func main() {
for {
// 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))
})
done := make(chan struct{})
go func() {
defer close(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))
})
}()
// wait
time.Sleep(5 * time.Second)