Skip to content

Commit 3f2423b

Browse files
cheukt10zingpd
authored andcommitted
RSDK-6625 - Invalid ffmpeg config causes config loop (#3571)
1 parent 2dd65de commit 3f2423b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

components/camera/ffmpeg/ffmpeg.go

+9
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ func NewFFMPEGCamera(ctx context.Context, conf *Config, logger logging.Logger) (
102102

103103
ffCam.activeBackgroundWorkers.Add(1)
104104
viamutils.ManagedGo(func() {
105+
select {
106+
case <-cancelableCtx.Done():
107+
return
108+
default:
109+
}
105110
stream := ffmpeg.Input(conf.VideoPath, conf.InputKWArgs)
106111
for _, filter := range conf.Filters {
107112
stream = stream.Filter(filter.Name, filter.Args, filter.KWArgs)
@@ -115,6 +120,10 @@ func NewFFMPEGCamera(ctx context.Context, conf *Config, logger logging.Logger) (
115120
return
116121
}
117122
if cmd.ProcessState.ExitCode() != 0 {
123+
// A bad ffmpeg resource configuration can cause the ffmpeg program to exit
124+
// with a non-zero code. This goroutine will infinitely loop until the user
125+
// fixes the configuration. A change in configuration Closes this object,
126+
// canceling the cancelableCtx.
118127
panic(err)
119128
}
120129
}

0 commit comments

Comments
 (0)