mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 06:46:42 +08:00
update docs
This commit is contained in:
@@ -42,7 +42,8 @@ func (sh *serverHandler) OnSessionClose(ctx *gortsplib.ServerHandlerOnSessionClo
|
||||
sh.mutex.Lock()
|
||||
defer sh.mutex.Unlock()
|
||||
|
||||
// close stream-related listeners and disconnect every reader
|
||||
// if the session is the publisher,
|
||||
// close the stream and disconnect any reader.
|
||||
if sh.stream != nil && ctx.Session == sh.publisher {
|
||||
sh.stream.Close()
|
||||
sh.stream = nil
|
||||
@@ -63,6 +64,7 @@ func (sh *serverHandler) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (
|
||||
}, nil, nil
|
||||
}
|
||||
|
||||
// send the track list that is being published to the client
|
||||
return &base.Response{
|
||||
StatusCode: base.StatusOK,
|
||||
}, sh.stream, nil
|
||||
@@ -81,6 +83,7 @@ func (sh *serverHandler) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (
|
||||
}, fmt.Errorf("someone is already publishing")
|
||||
}
|
||||
|
||||
// save the track list and the publisher
|
||||
sh.stream = gortsplib.NewServerStream(ctx.Tracks)
|
||||
sh.publisher = ctx.Session
|
||||
|
||||
@@ -128,7 +131,7 @@ func (sh *serverHandler) OnPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx)
|
||||
sh.mutex.Lock()
|
||||
defer sh.mutex.Unlock()
|
||||
|
||||
// if we are the publisher, route the RTP packet to readers
|
||||
// if we are the publisher, route the RTP packet to all readers
|
||||
if ctx.Session == sh.publisher {
|
||||
sh.stream.WritePacketRTP(ctx.TrackID, ctx.Packet, ctx.PTSEqualsDTS)
|
||||
}
|
||||
|
Reference in New Issue
Block a user