Fixed a buffer overflow error when converting videos when the video is more than 2 hours long.
This commit is contained in:
parent
ee0a305972
commit
48f8c577c0
@ -178,19 +178,30 @@ func (p Progress) Run(stdOut io.ReadCloser, stdErr io.ReadCloser) error {
|
|||||||
progress := 0.0
|
progress := 0.0
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
scannerErr := bufio.NewScanner(stdErr)
|
scannerErr := bufio.NewReader(stdErr)
|
||||||
for scannerErr.Scan() {
|
for {
|
||||||
errorText = scannerErr.Text()
|
line, _, err := scannerErr.ReadLine()
|
||||||
}
|
if err != nil {
|
||||||
if err := scannerErr.Err(); err != nil {
|
if err == io.EOF {
|
||||||
errorText = err.Error()
|
break
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
data := strings.TrimSpace(string(line))
|
||||||
|
errorText = data
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
scannerOut := bufio.NewScanner(stdOut)
|
scannerOut := bufio.NewReader(stdOut)
|
||||||
for scannerOut.Scan() {
|
for {
|
||||||
data := scannerOut.Text()
|
line, _, err := scannerOut.ReadLine()
|
||||||
|
if err != nil {
|
||||||
|
if err == io.EOF {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
data := strings.TrimSpace(string(line))
|
||||||
if strings.Contains(data, "progress=end") {
|
if strings.Contains(data, "progress=end") {
|
||||||
p.progressbar.Value = p.totalDuration
|
p.progressbar.Value = p.totalDuration
|
||||||
p.progressbar.Refresh()
|
p.progressbar.Refresh()
|
||||||
|
Loading…
Reference in New Issue
Block a user