diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index edd939ba..04d1e308 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1720,18 +1720,27 @@ func C_RTMP_ConnectStream(r *C.RTMP, seekTime int32) int { packet.m_packetType == RTMP_PACKET_TYPE_VIDEO || packet.m_packetType == RTMP_PACKET_TYPE_INFO { log.Println("C_RTMP_ConnectStream: got packet before play()! Ignoring.") - C.RTMPPacket_Free(&packet) + C_RTMPPacket_Free(&packet) continue } // TODO: port this C.RTMP_ClientPacket(r, &packet) - C.RTMPPacket_Free(&packet) + C_RTMPPacket_Free(&packet) } } return int(r.m_bPlaying) } +// void RTMPPacket_Free(RTMPPacket* p); +// rtmp.c +203 +func C_RTMPPacket_Free(p *C.RTMPPacket) { + if p.m_body != nil { + C.free(decBytePtr(unsafe.Pointer(p.m_body), RTMP_MAX_HEADER_SIZE)) + p.m_body = nil + } +} + // int RTMP_ReadPacket(RTMP* r, RTMPPacket* packet); // rtmp.c +3550 func C_RTMP_ReadPacket(r *C.RTMP, packet *C.RTMPPacket) int32 { @@ -2372,7 +2381,6 @@ func C_WriteN(r *C.RTMP, buffer unsafe.Pointer, n int) int { for n > 0 { var nBytes int - // TODO: port this if necessary nBytes = int(C_RTMPSockBuf_Send(&r.m_sb, (*byte)(ptr), int32(n))) if nBytes < 0 {