rtmp: make C_RTMPChunk.c_chunk a []byte

This commit is contained in:
Dan Kortschak 2018-09-12 13:40:17 +09:30
parent f387b827ae
commit 86e07e2b32
2 changed files with 3 additions and 7 deletions

View File

@ -1422,11 +1422,8 @@ func C_RTMP_ReadPacket(r *C_RTMP, packet *C_RTMPPacket) (ok bool) {
if packet.m_chunk != nil { if packet.m_chunk != nil {
packet.m_chunk.c_headerSize = hSize packet.m_chunk.c_headerSize = hSize
memmove(unsafe.Pointer(&packet.m_chunk.c_header[0]), unsafe.Pointer(&hbuf[0]), copy(packet.m_chunk.c_header[:], hbuf[:hSize])
uintptr(hSize)) packet.m_chunk.c_chunk = (*[_Gi]byte)(unsafe.Pointer(packet.m_body))[packet.m_nBytesRead : packet.m_nBytesRead+uint32(nChunk)]
packet.m_chunk.c_chunk = (*byte)(incBytePtr(unsafe.Pointer(packet.m_body),
int(packet.m_nBytesRead)))
packet.m_chunk.c_chunkSize = nChunk
} }
if C_ReadN(r, (*byte)(incBytePtr(unsafe.Pointer(packet.m_body), int(packet.m_nBytesRead))), if C_ReadN(r, (*byte)(incBytePtr(unsafe.Pointer(packet.m_body), int(packet.m_nBytesRead))),

View File

@ -114,8 +114,7 @@ const (
// rtmp.h +105 // rtmp.h +105
type C_RTMPChunk struct { type C_RTMPChunk struct {
c_headerSize int32 c_headerSize int32
c_chunkSize int32 c_chunk []byte
c_chunk *byte
c_header [RTMP_MAX_HEADER_SIZE]byte c_header [RTMP_MAX_HEADER_SIZE]byte
} }