mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
remove ServerHandler.Server
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
// 3. allow multiple clients to read that stream with TCP, UDP or UDP-multicast
|
||||
|
||||
type serverHandler struct {
|
||||
s *gortsplib.Server
|
||||
mutex sync.Mutex
|
||||
stream *gortsplib.ServerStream
|
||||
publisher *gortsplib.ServerSession
|
||||
@@ -87,7 +88,7 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
|
||||
}
|
||||
|
||||
// create the stream and save the publisher
|
||||
sh.stream = gortsplib.NewServerStream(ctx.Server, ctx.Medias)
|
||||
sh.stream = gortsplib.NewServerStream(sh.s, ctx.Medias)
|
||||
sh.publisher = ctx.Session
|
||||
|
||||
return &base.Response{
|
||||
@@ -137,8 +138,9 @@ func (sh *serverHandler) OnRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*bas
|
||||
|
||||
func main() {
|
||||
// configure the server
|
||||
s := &gortsplib.Server{
|
||||
Handler: &serverHandler{},
|
||||
h := &serverHandler{}
|
||||
h.s = &gortsplib.Server{
|
||||
Handler: h,
|
||||
RTSPAddress: ":8554",
|
||||
UDPRTPAddress: ":8000",
|
||||
UDPRTCPAddress: ":8001",
|
||||
@@ -149,5 +151,5 @@ func main() {
|
||||
|
||||
// start server and wait until a fatal error
|
||||
log.Printf("server is ready")
|
||||
panic(s.StartAndWait())
|
||||
panic(h.s.StartAndWait())
|
||||
}
|
||||
|
Reference in New Issue
Block a user