partially revert cabfcd6

This commit is contained in:
aler9
2022-12-22 20:36:41 +01:00
parent ae9dac0ad3
commit 5a2ea9cf9c
14 changed files with 9 additions and 25 deletions

View File

@@ -38,6 +38,13 @@ func main() {
log.Printf("republishing %d medias", len(medias))
// setup all medias
// this must be called before StartRecording(), that overrides the control attribute.
err = reader.SetupAll(medias, baseURL)
if err != nil {
panic(err)
}
// connect to the server and start recording the same medias
publisher := gortsplib.Client{}
err = publisher.StartRecording("rtsp://localhost:8554/mystream2", medias)
@@ -46,12 +53,6 @@ func main() {
}
defer publisher.Close()
// setup all medias
err = reader.SetupAll(medias, baseURL)
if err != nil {
panic(err)
}
// read RTP packets from reader and write them to publisher
reader.OnPacketRTPAny(func(medi *media.Media, forma format.Format, pkt *rtp.Packet) {
publisher.WritePacketRTP(medi, pkt)