|
|
@ -39,13 +39,12 @@ type rtspSession struct { |
|
|
|
pathManager rtspSessionPathManager |
|
|
|
pathManager rtspSessionPathManager |
|
|
|
parent rtspSessionParent |
|
|
|
parent rtspSessionParent |
|
|
|
|
|
|
|
|
|
|
|
created time.Time |
|
|
|
created time.Time |
|
|
|
path *path |
|
|
|
path *path |
|
|
|
stream *stream |
|
|
|
stream *stream |
|
|
|
state gortsplib.ServerSessionState |
|
|
|
state gortsplib.ServerSessionState |
|
|
|
stateMutex sync.Mutex |
|
|
|
stateMutex sync.Mutex |
|
|
|
onReadCmd *externalcmd.Cmd // read
|
|
|
|
onReadCmd *externalcmd.Cmd // read
|
|
|
|
announcedTracks gortsplib.Tracks // publish
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func newRTSPSession( |
|
|
|
func newRTSPSession( |
|
|
@ -155,7 +154,6 @@ func (s *rtspSession) onAnnounce(c *rtspConn, ctx *gortsplib.ServerHandlerOnAnno |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
s.path = res.path |
|
|
|
s.path = res.path |
|
|
|
s.announcedTracks = ctx.Tracks |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s.stateMutex.Lock() |
|
|
|
s.stateMutex.Lock() |
|
|
|
s.state = gortsplib.ServerSessionStatePreRecord |
|
|
|
s.state = gortsplib.ServerSessionStatePreRecord |
|
|
@ -289,7 +287,7 @@ func (s *rtspSession) onPlay(ctx *gortsplib.ServerHandlerOnPlayCtx) (*base.Respo |
|
|
|
func (s *rtspSession) onRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*base.Response, error) { |
|
|
|
func (s *rtspSession) onRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*base.Response, error) { |
|
|
|
res := s.path.publisherStart(pathPublisherStartReq{ |
|
|
|
res := s.path.publisherStart(pathPublisherStartReq{ |
|
|
|
author: s, |
|
|
|
author: s, |
|
|
|
tracks: s.announcedTracks, |
|
|
|
tracks: s.ss.AnnouncedTracks(), |
|
|
|
generateRTPPackets: false, |
|
|
|
generateRTPPackets: false, |
|
|
|
}) |
|
|
|
}) |
|
|
|
if res.err != nil { |
|
|
|
if res.err != nil { |
|
|
@ -301,7 +299,7 @@ func (s *rtspSession) onRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*base.R |
|
|
|
s.log(logger.Info, "is publishing to path '%s', with %s, %s", |
|
|
|
s.log(logger.Info, "is publishing to path '%s', with %s, %s", |
|
|
|
s.path.Name(), |
|
|
|
s.path.Name(), |
|
|
|
s.ss.SetuppedTransport(), |
|
|
|
s.ss.SetuppedTransport(), |
|
|
|
sourceTrackInfo(s.announcedTracks)) |
|
|
|
sourceTrackInfo(s.ss.AnnouncedTracks())) |
|
|
|
|
|
|
|
|
|
|
|
s.stream = res.stream |
|
|
|
s.stream = res.stream |
|
|
|
|
|
|
|
|
|
|
@ -381,7 +379,7 @@ func (s *rtspSession) apiSourceDescribe() interface{} { |
|
|
|
func (s *rtspSession) onPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) { |
|
|
|
func (s *rtspSession) onPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) { |
|
|
|
var err error |
|
|
|
var err error |
|
|
|
|
|
|
|
|
|
|
|
switch s.announcedTracks[ctx.TrackID].(type) { |
|
|
|
switch s.ss.AnnouncedTracks()[ctx.TrackID].(type) { |
|
|
|
case *gortsplib.TrackH264: |
|
|
|
case *gortsplib.TrackH264: |
|
|
|
err = s.stream.writeData(&dataH264{ |
|
|
|
err = s.stream.writeData(&dataH264{ |
|
|
|
trackID: ctx.TrackID, |
|
|
|
trackID: ctx.TrackID, |
|
|
|