|
|
|
@ -21,7 +21,7 @@ import (
@@ -21,7 +21,7 @@ import (
|
|
|
|
|
"github.com/bluenviron/mediamtx/internal/stream" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func newEmptyTimer() *time.Timer { |
|
|
|
|
func emptyTimer() *time.Timer { |
|
|
|
|
t := time.NewTimer(0) |
|
|
|
|
<-t.C |
|
|
|
|
return t |
|
|
|
@ -122,10 +122,10 @@ func (pa *path) initialize() {
@@ -122,10 +122,10 @@ func (pa *path) initialize() {
|
|
|
|
|
pa.ctx = ctx |
|
|
|
|
pa.ctxCancel = ctxCancel |
|
|
|
|
pa.readers = make(map[defs.Reader]struct{}) |
|
|
|
|
pa.onDemandStaticSourceReadyTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandStaticSourceCloseTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandPublisherReadyTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandPublisherCloseTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandStaticSourceReadyTimer = emptyTimer() |
|
|
|
|
pa.onDemandStaticSourceCloseTimer = emptyTimer() |
|
|
|
|
pa.onDemandPublisherReadyTimer = emptyTimer() |
|
|
|
|
pa.onDemandPublisherCloseTimer = emptyTimer() |
|
|
|
|
pa.chReloadConf = make(chan *conf.Path) |
|
|
|
|
pa.chStaticSourceSetReady = make(chan defs.PathSourceStaticSetReadyReq) |
|
|
|
|
pa.chStaticSourceSetNotReady = make(chan defs.PathSourceStaticSetNotReadyReq) |
|
|
|
@ -393,7 +393,7 @@ func (pa *path) doSourceStaticSetReady(req defs.PathSourceStaticSetReadyReq) {
@@ -393,7 +393,7 @@ func (pa *path) doSourceStaticSetReady(req defs.PathSourceStaticSetReadyReq) {
|
|
|
|
|
|
|
|
|
|
if pa.conf.HasOnDemandStaticSource() { |
|
|
|
|
pa.onDemandStaticSourceReadyTimer.Stop() |
|
|
|
|
pa.onDemandStaticSourceReadyTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandStaticSourceReadyTimer = emptyTimer() |
|
|
|
|
pa.onDemandStaticSourceScheduleClose() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -515,7 +515,7 @@ func (pa *path) doStartPublisher(req defs.PathStartPublisherReq) {
@@ -515,7 +515,7 @@ func (pa *path) doStartPublisher(req defs.PathStartPublisherReq) {
|
|
|
|
|
|
|
|
|
|
if pa.conf.HasOnDemandPublisher() && pa.onDemandPublisherState != pathOnDemandStateInitial { |
|
|
|
|
pa.onDemandPublisherReadyTimer.Stop() |
|
|
|
|
pa.onDemandPublisherReadyTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandPublisherReadyTimer = emptyTimer() |
|
|
|
|
pa.onDemandPublisherScheduleClose() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -674,7 +674,7 @@ func (pa *path) onDemandStaticSourceScheduleClose() {
@@ -674,7 +674,7 @@ func (pa *path) onDemandStaticSourceScheduleClose() {
|
|
|
|
|
func (pa *path) onDemandStaticSourceStop(reason string) { |
|
|
|
|
if pa.onDemandStaticSourceState == pathOnDemandStateClosing { |
|
|
|
|
pa.onDemandStaticSourceCloseTimer.Stop() |
|
|
|
|
pa.onDemandStaticSourceCloseTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandStaticSourceCloseTimer = emptyTimer() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pa.onDemandStaticSourceState = pathOnDemandStateInitial |
|
|
|
@ -707,7 +707,7 @@ func (pa *path) onDemandPublisherScheduleClose() {
@@ -707,7 +707,7 @@ func (pa *path) onDemandPublisherScheduleClose() {
|
|
|
|
|
func (pa *path) onDemandPublisherStop(reason string) { |
|
|
|
|
if pa.onDemandPublisherState == pathOnDemandStateClosing { |
|
|
|
|
pa.onDemandPublisherCloseTimer.Stop() |
|
|
|
|
pa.onDemandPublisherCloseTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandPublisherCloseTimer = emptyTimer() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pa.onUnDemandHook(reason) |
|
|
|
@ -857,13 +857,13 @@ func (pa *path) addReaderPost(req defs.PathAddReaderReq) {
@@ -857,13 +857,13 @@ func (pa *path) addReaderPost(req defs.PathAddReaderReq) {
|
|
|
|
|
if pa.onDemandStaticSourceState == pathOnDemandStateClosing { |
|
|
|
|
pa.onDemandStaticSourceState = pathOnDemandStateReady |
|
|
|
|
pa.onDemandStaticSourceCloseTimer.Stop() |
|
|
|
|
pa.onDemandStaticSourceCloseTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandStaticSourceCloseTimer = emptyTimer() |
|
|
|
|
} |
|
|
|
|
} else if pa.conf.HasOnDemandPublisher() { |
|
|
|
|
if pa.onDemandPublisherState == pathOnDemandStateClosing { |
|
|
|
|
pa.onDemandPublisherState = pathOnDemandStateReady |
|
|
|
|
pa.onDemandPublisherCloseTimer.Stop() |
|
|
|
|
pa.onDemandPublisherCloseTimer = newEmptyTimer() |
|
|
|
|
pa.onDemandPublisherCloseTimer = emptyTimer() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|