Skip to content

Commit

Permalink
Merge pull request #74 from gongym12138/patch-1
Browse files Browse the repository at this point in the history
Update transcoder.go
  • Loading branch information
xfrr committed Aug 25, 2020
2 parents d910add + aa6bff6 commit 5550d23
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions transcoder/transcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5550d23

Please sign in to comment.