Implemented ported rtmpEnableWrite

This commit is contained in:
saxon 2018-07-20 21:31:55 +09:30
parent ee09683248
commit cba28550e2
1 changed files with 11 additions and 3 deletions

View File

@ -364,18 +364,22 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) {
rtmpInit(rtmp) rtmpInit(rtmp)
rtmp.Link.timeout = connect_timeout rtmp.Link.timeout = connect_timeout
if rtmpSetupUrl(rtmp, u) == 0 { if rtmpSetupUrl(rtmp, u) == 0 {
//C.RTMP_Clos(rtmp)
//C.RTMP_Free(rtmp)
return nil, errors.New("rtmp startSession: Failed to setup URL!") return nil, errors.New("rtmp startSession: Failed to setup URL!")
} }
C.RTMP_EnableWrite(rtmp) rtmpEnableWrite(rtmp)
C.RTMP_SetBufferMS(rtmp, 3600*1000) C.RTMP_SetBufferMS(rtmp, 3600*1000)
if C.RTMP_Connect(rtmp, nil) == 0 { if C.RTMP_Connect(rtmp, nil) == 0 {
//C.RTMP_Close(rtmp)
//C.RTMP_Free(rtmp)
return nil, errors.New("rtmp startSession: Failed to connect!") return nil, errors.New("rtmp startSession: Failed to connect!")
} }
if C.RTMP_ConnectStream(rtmp, 0) == 0 { if C.RTMP_ConnectStream(rtmp, 0) == 0 {
C.RTMP_Close(rtmp) //C.RTMP_Close(rtmp)
C.RTMP_Free(rtmp) //C.RTMP_Free(rtmp)
return nil, errors.New("rtmp startSession: Failed to connect stream!") return nil, errors.New("rtmp startSession: Failed to connect stream!")
} }
@ -551,6 +555,10 @@ func closeInternal(r *C.RTMP, reconnect int32) {
} }
} }
func rtmpEnableWrite(r *C.RTMP) {
r.Link.protocol |= RTMP_FEATURE_WRITE
}
/* /*
func socksSetup(r *RTMP, sockshost *AVal) { func socksSetup(r *RTMP, sockshost *AVal) {
if sockshost.av_len != 0 { if sockshost.av_len != 0 {