diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 3bd6e9f4..c14e11af 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -364,18 +364,22 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) { rtmpInit(rtmp) rtmp.Link.timeout = connect_timeout if rtmpSetupUrl(rtmp, u) == 0 { + //C.RTMP_Clos(rtmp) + //C.RTMP_Free(rtmp) return nil, errors.New("rtmp startSession: Failed to setup URL!") } - C.RTMP_EnableWrite(rtmp) + rtmpEnableWrite(rtmp) C.RTMP_SetBufferMS(rtmp, 3600*1000) if C.RTMP_Connect(rtmp, nil) == 0 { + //C.RTMP_Close(rtmp) + //C.RTMP_Free(rtmp) return nil, errors.New("rtmp startSession: Failed to connect!") } if C.RTMP_ConnectStream(rtmp, 0) == 0 { - C.RTMP_Close(rtmp) - C.RTMP_Free(rtmp) + //C.RTMP_Close(rtmp) + //C.RTMP_Free(rtmp) 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) { if sockshost.av_len != 0 {