mirror of
https://github.com/xfrr/goffmpeg.git
synced 2025-10-05 14:46:51 +08:00
Update transcoder.go
This commit is contained in:
@@ -306,14 +306,16 @@ func (t Transcoder) Output() <-chan models.Progress {
|
||||
if atEOF && len(data) == 0 {
|
||||
return 0, nil, nil
|
||||
}
|
||||
if i := bytes.IndexByte(data, '\n'); i >= 0 {
|
||||
// We have a full newline-terminated line.
|
||||
return i + 1, data[0:i], nil
|
||||
}
|
||||
//windows \r\n
|
||||
//so first \r and then \n can remove unexpected line break
|
||||
if i := bytes.IndexByte(data, '\r'); i >= 0 {
|
||||
// We have a cr terminated line
|
||||
return i + 1, data[0:i], nil
|
||||
}
|
||||
if i := bytes.IndexByte(data, '\n'); i >= 0 {
|
||||
// We have a full newline-terminated line.
|
||||
return i + 1, data[0:i], nil
|
||||
}
|
||||
if atEOF {
|
||||
return len(data), data, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user