From bc007a09f8d8ff448f02210fe5633f01ec56c5b8 Mon Sep 17 00:00:00 2001 From: saxon Date: Sat, 14 Jul 2018 15:36:58 +0930 Subject: [PATCH] Just saving my progress :) --- rtmp/rtmp.go | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 637ac311..c24ada99 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -252,7 +252,6 @@ func incPtr(ptr unsafe.Pointer, inc int) unsafe.Pointer { return unsafe.Pointer(uintptr(ptr) + uintptr(inc)) } -/* func sendPacket(r *C.RTMP, pkt *C.RTMPPacket, queue int) int { const prevPacket *C.RTMPPacket last := 0 @@ -264,8 +263,26 @@ func sendPacket(r *C.RTMP, pkt *C.RTMPPacket, queue int) int { var t int32 var tbuf *C.char = nil var toff *C.char = nil + + if packet.m_nChannel >= r.m_channelsAllocatedOut { + n := int(packet.m_nChannel+10) + packets := C.realloc(r.m_vecChannelsOut, unsafe.Sizeof(*C.RTMPPacket) * n) + + if packets == 0 { + C.free(r.m_vecChannelsOut) + r.m_vecChannelsOut = nil + r.m_channelsAllocatedOut = 0 + return 0 + } + r.m_vecChannelsOut = packets + C.memset(r.m_vecChannelsOut + r.m_channelsAllocatedOut, 0, + unsafe.Sizeof(*RTMPPacket) * (n-r.m_channelsAllocatedOut)) + r.m_channelsAllocatedOut = n + } + + } -*/ + // Close terminates the rtmp connection func (s *session) Close() error {