add partial client read example; fix #16

This commit is contained in:
aler9
2020-11-30 14:42:32 +01:00
parent 544784a539
commit b77433bc9d
9 changed files with 102 additions and 39 deletions

View File

@@ -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)
}
}
}