Replies: 1 comment 1 reply
-
Hello, if you want to support multiple streams, you have to save those streams somewhere, index them by some parameter (for instance, the path name) and serve them by using this chosen parameter, like was done in MediaMTX. Example: // called when receiving an ANNOUNCE request.
func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (*base.Response, error) {
log.Printf("announce request")
sh.mutex.Lock()
defer sh.mutex.Unlock()
stream, ok := sh.streams[ctx.Path]
// disconnect existing publisher
if ok {
sh.stream.Close()
sh.publishers[ctx.Path].Close()
}
// create the stream and save the publisher
sh.streams[ctx.Path] = gortsplib.NewServerStream(sh.s, ctx.Description)
sh.publishers[ctx.Path] = ctx.Session
return &base.Response{
StatusCode: base.StatusOK,
}, nil
} where |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Based on gortsplib/examples/server/main.go is there a way to allow multiple client to publish a stream instead of a single one ?
Beta Was this translation helpful? Give feedback.
All reactions