mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 07:37:07 +08:00
cleanup example
This commit is contained in:
@@ -39,7 +39,14 @@ func main() {
|
|||||||
|
|
||||||
// read RTP packets
|
// read RTP packets
|
||||||
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
|
err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {
|
||||||
if streamType == gortsplib.StreamTypeRTP && trackID == h264Track {
|
if streamType != gortsplib.StreamTypeRTP {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if trackID != h264Track {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// convert RTP packets into H264 NALUs
|
// convert RTP packets into H264 NALUs
|
||||||
nalus, _, err := dec.Decode(payload)
|
nalus, _, err := dec.Decode(payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -50,7 +57,6 @@ func main() {
|
|||||||
for _, nalu := range nalus {
|
for _, nalu := range nalus {
|
||||||
fmt.Printf("received H264 NALU of size %d\n", len(nalu))
|
fmt.Printf("received H264 NALU of size %d\n", len(nalu))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user