mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
add partial client read example; fix #16
This commit is contained in:
@@ -11,9 +11,9 @@ import (
|
||||
)
|
||||
|
||||
// This example shows how to
|
||||
// * generate RTP/H264 frames from a file with Gstreamer
|
||||
// * connect to a RTSP server, announce a H264 track
|
||||
// * write the frames of the track
|
||||
// 1. generate RTP/H264 frames from a file with Gstreamer
|
||||
// 2. connect to a RTSP server, announce a H264 track
|
||||
// 3. write the frames of the track
|
||||
|
||||
func main() {
|
||||
// open a listener to receive RTP/H264 frames
|
||||
@@ -54,14 +54,13 @@ func main() {
|
||||
// read frames from the source
|
||||
n, _, err := pc.ReadFrom(buf)
|
||||
if err != nil {
|
||||
break
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// write track frames
|
||||
err = conn.WriteFrame(track.Id, gortsplib.StreamTypeRtp, buf[:n])
|
||||
if err != nil {
|
||||
fmt.Printf("connection is closed (%s)\n", err)
|
||||
break
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user