rtmp: continued to port C_SendFCUnpublish - paused - need to work out best way to get rid of unsafe pointers

This commit is contained in:
saxon 2018-08-26 00:27:38 +09:30
parent 9384927113
commit b846dbf2d7
1 changed files with 25 additions and 1 deletions

View File

@ -1086,7 +1086,31 @@ func C_SendFCUnpublish(r *C_RTMP) int32 {
/*
var packet C_RTMPPacket
var pbuf [1024]byte
var pend []byte =
var pend []byte = pbuf[1024:]
var enc []byte
packet.m_nChannel = 0x03
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM
packet.m_packetType = RTMP_PACKET_TYPE_INVOKE
packet.m_nTimeStamp = 0
packet.m_nInfoField2 = 0
packet.m_hasAbsTimestamp = 0
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE
// NOTE use of unsafe pointer will be remove here when packet.m_nBody becomes []byte
enc = []byte(unsafe.Pointer(packet.m_nBody))
enc = C_AMF_EncodeString((*byte)(unsafe.Pointer(&enc[0])),
(*byte)(unsafe.Pointer(&pend[0])), &av_FCUnpublish)
r.m_numInvokes++
enc = C_AMF_EncodeNumber(enc, pend, r->m_numInvokes);
*enc++ = AMF_NULL;
enc = AMF_EncodeString(enc, pend, &r->Link.playpath);
if (!enc)
return FALSE;
packet.m_nBodySize = enc - packet.m_body;
return RTMP_SendPacket(r, &packet, FALSE);
*/
return 0
}