Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pkg/pipeline/source/sdk/appwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ func (w *AppWriter) pushPacket(pkt jitter.ExtPacket) error {
w.callbacks.OnDebugDotRequest("appsrc_flush_" + w.track.ID())
}
}
if w.flushingCount == flushingThreshold/2 {
w.recoverFromFlushing()
}
if w.flushingCount >= flushingThreshold {
return errFlowFlushingThreshold
}
Expand All @@ -615,6 +618,21 @@ func (w *AppWriter) pushPacket(pkt jitter.ExtPacket) error {
return nil
}

// recoverFromFlushing restarts an appsrc stranded with its internal flushing
func (w *AppWriter) recoverFromFlushing() {
w.logger.Infow("attempting FlowFlushing recovery",
"flushingCount", w.flushingCount,
"appsrcState", w.src.Element.GetCurrentState().String())
if !w.src.SendEvent(gst.NewFlushStartEvent()) {
w.logger.Warnw("failed to send recovery flush start event", nil)
return
}
if !w.src.SendEvent(gst.NewFlushStopEvent(false)) {
w.logger.Warnw("failed to send recovery flush stop event", nil)
}
w.logger.Infow("FlowFlushing recovery successful")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this successful even if flush stop send fails?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh - no - it could be misleading - will update it - good catch - thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

}

func (w *AppWriter) maybeCheckPipelineLag(pts time.Duration) {
if pts-w.lastPipelineCheckPTS < pipelineCheckInterval {
return
Expand Down
Loading