Fix external producers
This commit is contained in:
@@ -14,6 +14,7 @@ const (
|
||||
stateMedias
|
||||
stateTracks
|
||||
stateStart
|
||||
stateExternal
|
||||
)
|
||||
|
||||
type Producer struct {
|
||||
@@ -71,11 +72,6 @@ func (p *Producer) GetTrack(media *streamer.Media, codec *streamer.Codec) *strea
|
||||
}
|
||||
}
|
||||
|
||||
// can't get new tracks after start
|
||||
if p.state == stateStart {
|
||||
return nil
|
||||
}
|
||||
|
||||
track := p.element.GetTrack(media, codec)
|
||||
if track == nil {
|
||||
return nil
|
||||
@@ -162,6 +158,12 @@ func (p *Producer) reconnect() {
|
||||
|
||||
func (p *Producer) stop() {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
if p.state == stateExternal {
|
||||
log.Debug().Msgf("[streams] can't stop external producer")
|
||||
return
|
||||
}
|
||||
|
||||
log.Debug().Msgf("[streams] stop producer url=%s", p.url)
|
||||
|
||||
@@ -176,6 +178,4 @@ func (p *Producer) stop() {
|
||||
|
||||
p.state = stateNone
|
||||
p.tracks = nil
|
||||
|
||||
p.mu.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user