Use unsigned ints for timeouts.

This commit is contained in:
scruzin 2019-01-06 09:37:21 +10:30
parent e173153ca6
commit be1610b67f
3 changed files with 5 additions and 6 deletions

View File

@ -135,11 +135,10 @@ var (
errConnStream = errors.New("Connection stream error") errConnStream = errors.New("Connection stream error")
) )
func startSession(rtmp *C_RTMP, u string, timeout uint32) (*C_RTMP, error) { func startSession(rtmp *C_RTMP, u string, timeout uint) (*C_RTMP, error) {
connect_timeout := int32(timeout)
rtmp = C_RTMP_Alloc() rtmp = C_RTMP_Alloc()
C_RTMP_Init(rtmp) C_RTMP_Init(rtmp)
rtmp.Link.timeout = connect_timeout rtmp.Link.timeout = timeout
err := C_RTMP_SetupURL(rtmp, u) err := C_RTMP_SetupURL(rtmp, u)
if err != nil { if err != nil {
C_RTMP_Close(rtmp) C_RTMP_Close(rtmp)

View File

@ -140,7 +140,7 @@ type C_RTMPPacket struct {
// rtmp.h +127 // rtmp.h +127
type C_RTMPSockBuf struct { type C_RTMPSockBuf struct {
conn *net.TCPConn conn *net.TCPConn
timeout int32 timeout uint
sb_size int sb_size int
sb_start int sb_start int
sb_buf [RTMP_BUFFER_CACHE_SIZE]byte // port const sb_buf [RTMP_BUFFER_CACHE_SIZE]byte // port const
@ -170,7 +170,7 @@ type C_RTMP_LNK struct {
lFlags int32 lFlags int32
swfAge int32 swfAge int32
protocol int32 protocol int32
timeout int32 timeout uint
port uint16 port uint16
} }

View File

@ -58,7 +58,7 @@ func (s *Session) Open() error {
return errors.New("rtmp: attempt to start already running session") return errors.New("rtmp: attempt to start already running session")
} }
var err error var err error
s.rtmp, err = startSession(s.rtmp, s.url, uint32(s.timeout)) s.rtmp, err = startSession(s.rtmp, s.url, s.timeout)
if s.rtmp == nil { if s.rtmp == nil {
return err return err
} }