Skip to content

Commit

Permalink
cut blockSetState short if it hangs (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Jun 30, 2023
1 parent 249a7d2 commit 37299d7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,20 @@ func (p *Pipeline) stop() {
return
}

_ = p.pipeline.BlockSetState(gst.StateNull)
stateChange := make(chan error, 1)
go func() {
stateChange <- p.pipeline.BlockSetState(gst.StateNull)
}()

select {
case err := <-stateChange:
if err != nil {
logger.Errorw("SetStateNull failed", err)
}
case <-time.After(eosTimeout):
logger.Errorw("SetStateNull timed out", nil)
}

endedAt := time.Now().UnixNano()
logger.Infow("pipeline stopped")

Expand Down

0 comments on commit 37299d7

Please sign in to comment.