split readPublisher into reader and publisher

This commit is contained in:
aler9
2021-07-31 20:46:06 +02:00
parent 1a7f26ce29
commit eee64a1450
12 changed files with 579 additions and 574 deletions

View File

@@ -23,8 +23,8 @@ const (
type rtspSourceParent interface {
Log(logger.Level, string, ...interface{})
OnSourceExternalSetReady(req sourceExtSetReadyReq)
OnSourceExternalSetNotReady(req sourceExtSetNotReadyReq)
OnSourceStaticSetReady(req pathSourceStaticSetReadyReq)
OnSourceStaticSetNotReady(req pathSourceStaticSetNotReadyReq)
OnSourceFrame(int, gortsplib.StreamType, []byte)
}
@@ -94,8 +94,8 @@ func (s *rtspSource) Close() {
// IsSource implements source.
func (s *rtspSource) IsSource() {}
// IsSourceExternal implements sourceExternal.
func (s *rtspSource) IsSourceExternal() {}
// IsSourceStatic implements sourceStatic.
func (s *rtspSource) IsSourceStatic() {}
func (s *rtspSource) log(level logger.Level, format string, args ...interface{}) {
s.parent.Log(level, "[rtsp source] "+format, args...)
@@ -187,12 +187,12 @@ func (s *rtspSource) runInner() bool {
s.log(logger.Info, "ready")
s.parent.OnSourceExternalSetReady(sourceExtSetReadyReq{
s.parent.OnSourceStaticSetReady(pathSourceStaticSetReadyReq{
Tracks: conn.Tracks(),
})
defer func() {
s.parent.OnSourceExternalSetNotReady(sourceExtSetNotReadyReq{})
s.parent.OnSourceStaticSetNotReady(pathSourceStaticSetNotReadyReq{})
}()
readErr := make(chan error)