From e04ae76dcfd56296c1ce0ce5a0dcaefb9de7f651 Mon Sep 17 00:00:00 2001 From: saxon Date: Thu, 19 Jul 2018 17:30:30 +0930 Subject: [PATCH] Wrote rtmp init func --- rtmp/rtmp.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index c71de5a1..2135e258 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -322,7 +322,7 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) { url := C.CString(u) connect_timeout := C.int(timeout) rtmp = rtmpAlloc() - C.RTMP_Init(rtmp) + rtmpInit(rtmp) rtmp.Link.timeout = connect_timeout if C.RTMP_SetupURL(rtmp, url) == 0 { C.RTMP_Close(rtmp) @@ -352,6 +352,20 @@ func rtmpAlloc() *C.RTMP { return (*C.RTMP)(allocate(unsafe.Sizeof(r))) } +func rtmpInit(r *C.RTMP) { + r.m_sb.sb_socket = -1 + r.m_inChunkSize = RTMP_DEFAULT_CHUNKSIZE + r.m_outChunkSize = RTMP_DEFAULT_CHUNKSIZE + r.m_nBufferMS = 30000 + r.m_nClientBW = 2500000 + r.m_nClientBW2 = 2 + r.m_nServerBW = 2500000 + r.m_fAudioCodecs = 3191.0 + r.m_fVideoCodecs = 252.0 + r.Link.timeout = 30 + r.Link.swfAge = 30 +} + // Close terminates the rtmp connection func (s *session) Close() error { if s.rtmp == nil {