Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Commit 13ecc32

Browse files
committed
wait ffmpeg 3 second
1 parent 67bc95b commit 13ecc32

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.idea/.gitignore

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ffmpeg/ffmpeg.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,15 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
104104
return nil, fmt.Errorf("Failed starting transcoding (%s) with args (%s) with error %s", t.config.FfmpegBinPath, args, err)
105105
}
106106

107-
if (t.config.ProgressEnabled && !t.config.Verbose) || (int(t.config.Timeout) > 0) {
107+
if t.config.ProgressEnabled && !t.config.Verbose {
108+
108109
if t.config.ProgressEnabled {
109110
go func() {
110111
t.progress(stderrIn, out)
111112
}()
112113
}
114+
}
115+
if int(t.config.Timeout) > 0 {
113116
done := make(chan error, 1)
114117
go func() {
115118
defer close(out)
@@ -118,8 +121,13 @@ func (t *Transcoder) Start(opts transcoder.Options) (<-chan transcoder.Progress,
118121
}()
119122
select {
120123
case <-time.After(t.config.Timeout):
121-
cmd.Process.Signal(syscall.SIGTERM)
122-
case <-done:
124+
err = cmd.Process.Signal(syscall.SIGINT)
125+
if err != nil {
126+
return nil, err
127+
}
128+
time.Sleep(3 * time.Second)
129+
130+
case err := <-done:
123131
if err != nil {
124132
return nil, err
125133
}

0 commit comments

Comments
 (0)