Add feature to SETUP new RTSP tracks after PLAY

This commit is contained in:
Alexey Khit
2022-12-01 23:37:11 +03:00
parent d3bd5eeab5
commit 8c6729027b
2 changed files with 9 additions and 2 deletions
+6
View File
@@ -404,6 +404,12 @@ func (c *Conn) SetupMedia(
}
}
// in case the track has already been setup before
if codec == nil {
c.state = StateSetup
return nil, nil
}
// we send our `interleaved`, but camera can answer with another
// Transport: RTP/AVP/TCP;unicast;interleaved=10-11;ssrc=10117CB7
+3 -2
View File
@@ -20,9 +20,10 @@ func (c *Conn) GetTrack(media *streamer.Media, codec *streamer.Codec) *streamer.
}
}
// can't setup new tracks from play state
// can't setup new tracks from play state - forcing a reconnection feature
if c.state == StatePlay {
return nil
go c.Close()
return streamer.NewTrack(codec, media.Direction)
}
track, err := c.SetupMedia(media, codec)