fix(ffmpeg): ffmpeg reader callback buffer fix (#16)
* fix(ffmpeg): ffmpeg reader callback buffer fix
This commit is contained in:
parent
ba7f527435
commit
41133360fd
3 changed files with 7 additions and 6 deletions
|
|
@ -15,14 +15,15 @@ func goPacketRead(opaque unsafe.Pointer, buffer *C.uint8_t, bufSize C.int) C.int
|
|||
if !ok || ctx.reader == nil {
|
||||
return C.int(ErrUnknown)
|
||||
}
|
||||
size := int(bufSize)
|
||||
sh := &reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(buffer)),
|
||||
Len: int(bufSize),
|
||||
Cap: int(bufSize),
|
||||
Len: size,
|
||||
Cap: size,
|
||||
}
|
||||
buf := *(*[]byte)(unsafe.Pointer(sh))
|
||||
n, err := ctx.reader.Read(buf)
|
||||
if err == io.EOF {
|
||||
if err == io.EOF && n == 0 {
|
||||
return C.int(ErrEOF)
|
||||
} else if err != nil {
|
||||
return C.int(ErrUnknown)
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -3,7 +3,7 @@ module github.com/cshum/imagorvideo
|
|||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/cshum/imagor v1.1.5
|
||||
github.com/cshum/imagor v1.1.6-0.20221007070003-bf5de432757f
|
||||
github.com/gabriel-vasile/mimetype v1.4.1
|
||||
github.com/stretchr/testify v1.8.0
|
||||
go.uber.org/zap v1.23.0
|
||||
|
|
|
|||
4
go.sum
4
go.sum
|
|
@ -85,8 +85,8 @@ github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWH
|
|||
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cshum/imagor v1.1.5 h1:wlHqR7i/T2pHxvINS6cq7VkKHihaoDiRUJNC13gRmQU=
|
||||
github.com/cshum/imagor v1.1.5/go.mod h1:7DEd2qtXj469uYoAj5SskR7GZKzwFowIhqYw/x3tlM4=
|
||||
github.com/cshum/imagor v1.1.6-0.20221007070003-bf5de432757f h1:xABrqcS9llwevJ5XnTbIpFwtZ6Te8OYRzM6I71Aog+Y=
|
||||
github.com/cshum/imagor v1.1.6-0.20221007070003-bf5de432757f/go.mod h1:7DEd2qtXj469uYoAj5SskR7GZKzwFowIhqYw/x3tlM4=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue