refactor(ffmpeg): handles EOF with buf exists
This commit is contained in:
parent
b35b9319e1
commit
33c1d38a21
1 changed files with 4 additions and 2 deletions
|
|
@ -23,8 +23,10 @@ func goPacketRead(opaque unsafe.Pointer, buffer *C.uint8_t, bufSize C.int) C.int
|
|||
}
|
||||
buf := *(*[]byte)(unsafe.Pointer(sh))
|
||||
n, err := ctx.reader.Read(buf)
|
||||
if err == io.EOF && n == 0 {
|
||||
if err == io.EOF {
|
||||
if n == 0 {
|
||||
return C.int(ErrEOF)
|
||||
}
|
||||
} else if err != nil {
|
||||
return C.int(ErrUnknown)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue