diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 09e42479..9c8e097e 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1422,11 +1422,8 @@ func C_RTMP_ReadPacket(r *C_RTMP, packet *C_RTMPPacket) (ok bool) { if packet.m_chunk != nil { packet.m_chunk.c_headerSize = hSize - memmove(unsafe.Pointer(&packet.m_chunk.c_header[0]), unsafe.Pointer(&hbuf[0]), - uintptr(hSize)) - packet.m_chunk.c_chunk = (*byte)(incBytePtr(unsafe.Pointer(packet.m_body), - int(packet.m_nBytesRead))) - packet.m_chunk.c_chunkSize = nChunk + copy(packet.m_chunk.c_header[:], hbuf[:hSize]) + packet.m_chunk.c_chunk = (*[_Gi]byte)(unsafe.Pointer(packet.m_body))[packet.m_nBytesRead : packet.m_nBytesRead+uint32(nChunk)] } if C_ReadN(r, (*byte)(incBytePtr(unsafe.Pointer(packet.m_body), int(packet.m_nBytesRead))), diff --git a/rtmp/rtmp_headers.go b/rtmp/rtmp_headers.go index 96aa2235..3fc0ac62 100644 --- a/rtmp/rtmp_headers.go +++ b/rtmp/rtmp_headers.go @@ -114,8 +114,7 @@ const ( // rtmp.h +105 type C_RTMPChunk struct { c_headerSize int32 - c_chunkSize int32 - c_chunk *byte + c_chunk []byte c_header [RTMP_MAX_HEADER_SIZE]byte }