From 232cb2280ffa0ff25f5aa8785869bc66716a213e Mon Sep 17 00:00:00 2001 From: saxon Date: Thu, 19 Jul 2018 16:51:16 +0930 Subject: [PATCH] Internal compiler error --- rtmp/rtmp.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 323d917e..2240ef95 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -139,7 +139,7 @@ const ( // memmove copies n bytes from "from" to "to". //go:linkname memmove runtime.memmove -//func memmove(to, from unsafe.Pointer, n uintptr) +func memmove(to, from unsafe.Pointer, n uintptr) // av_setDataFrame is a static const global in rtmp.c var setDataFrame = AVC("@setDataFrame") @@ -515,7 +515,8 @@ func afmEncodeString(output *byte, outend *byte, bv *C.AVal) *byte { outputPtr = unsafe.Pointer(C.AMF_EncodeInt32((*C.char)(outputPtr), (*C.char)(outendPtr), bv.av_len)) } - C.memcpy(unsafe.Pointer(outputPtr), unsafe.Pointer(bv.av_val), (C.size_t)(bv.av_len)) + memmove(unsafe.Pointer(outputPtr), unsafe.Pointer(bv.av_val), uintptr(bv.av_len)) + //C.memcpy(unsafe.Pointer(outputPtr), unsafe.Pointer(bv.av_val), (C.size_t)(bv.av_len)) incBytePtr(outputPtr, int(bv.av_len)) return (*byte)(outputPtr) @@ -783,11 +784,11 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int { (*C.RTMPPacket)(C.malloc(C.size_t(unsafe.Sizeof(*packet)))) } - //memmove(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel), - //int(unsafe.Sizeof(packet))),unsafe.Pointer(packet), unsafe.Sizeof(packet)) - C.memcpy(unsafe.Pointer(*(**C.RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut), - int(packet.m_nChannel), int(unsafe.Sizeof(packet))))), unsafe.Pointer(packet), - C.size_t(uintptr(unsafe.Sizeof(*packet)))) + memmove(incPtr(unsafe.Pointer(r.m_vecChannelsOut), int(packet.m_nChannel), + int(unsafe.Sizeof(packet))), unsafe.Pointer(packet), unsafe.Sizeof(packet)) + //C.memcpy(unsafe.Pointer(*(**C.RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut), + //int(packet.m_nChannel), int(unsafe.Sizeof(packet))))), unsafe.Pointer(packet), + //C.size_t(uintptr(unsafe.Sizeof(*packet)))) return 1 }