Panic: Send on closed channel #68
Unanswered
amirzenoozi
asked this question in
Questions
Replies: 2 comments
-
Hello, if you want to read 3 RTP/H264 packets and exit, the code is the following func main() {
// connect to the server and start reading all tracks
conn, err := gortsplib.DialRead("rtsp-link")
if err != nil {
panic(err)
}
done := make(chan struct{})
closed := false
frameCount := 0
conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) {
frameCount++
if frameCount >= 3 && !closed {
closed = true
close(done)
}
})
<-done
} But like i wrote in the other issue, you won't get video frames, but encoded RTP/H264 packets, that must be decoded into H264 NALUs, that must be decoded into video frames :) |
Beta Was this translation helpful? Give feedback.
0 replies
-
It Works But When We Put |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I Have a little problem when I try to close a connection, in some cases, I will get the below Error:
and my code is:
Beta Was this translation helpful? Give feedback.
All reactions