Added todo comments

This commit is contained in:
saxon 2018-07-14 14:52:54 +09:30
parent 965641be16
commit 3ae7bf79da
1 changed files with 7 additions and 1 deletions

View File

@ -132,6 +132,7 @@ func (s *session) Write(data []byte) (int, error) {
func rtmpWrite(r *C.RTMP, data []byte) int { func rtmpWrite(r *C.RTMP, data []byte) int {
buf := sliceToPtr(data) buf := sliceToPtr(data)
// TODO: port RTMPPacket
var pkt = &r.m_write var pkt = &r.m_write
var pend, enc unsafe.Pointer var pend, enc unsafe.Pointer
size := len(data) size := len(data)
@ -157,8 +158,10 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
pkt.m_packetType = C.uchar(*(*byte)(buf)) pkt.m_packetType = C.uchar(*(*byte)(buf))
buf = incPtr(buf,1) buf = incPtr(buf,1)
// TODO: port this
pkt.m_nBodySize = C.AMF_DecodeInt24((*C.char)(buf)) pkt.m_nBodySize = C.AMF_DecodeInt24((*C.char)(buf))
buf = incPtr(buf,3) buf = incPtr(buf,3)
// TODO: replace with ported version
pkt.m_nTimeStamp = C.AMF_DecodeInt24((*C.char)(buf)) pkt.m_nTimeStamp = C.AMF_DecodeInt24((*C.char)(buf))
buf = incPtr(buf,3) buf = incPtr(buf,3)
pkt.m_nTimeStamp |= C.uint(*((*byte)(buf))) << 24 pkt.m_nTimeStamp |= C.uint(*((*byte)(buf))) << 24
@ -177,7 +180,7 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
} else { } else {
pkt.m_headerType = RTMP_PACKET_SIZE_MEDIUM pkt.m_headerType = RTMP_PACKET_SIZE_MEDIUM
} }
// TODO: Port this
if int(C.RTMPPacket_Alloc(pkt, pkt.m_nBodySize)) == 0 { if int(C.RTMPPacket_Alloc(pkt, pkt.m_nBodySize)) == 0 {
log.Println("Failed to allocate packet") log.Println("Failed to allocate packet")
return 0 return 0
@ -187,6 +190,7 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
pend = incPtr(enc,int(pkt.m_nBodySize)) pend = incPtr(enc,int(pkt.m_nBodySize))
if pkt.m_packetType == RTMP_PACKET_TYPE_INFO { if pkt.m_packetType == RTMP_PACKET_TYPE_INFO {
// TODO: Port this
enc = unsafe.Pointer(C.AMF_EncodeString((*C.char)(enc), (*C.char)(pend), &setDataFrame)) enc = unsafe.Pointer(C.AMF_EncodeString((*C.char)(enc), (*C.char)(pend), &setDataFrame))
pkt.m_nBytesRead = C.uint(math.Abs(float64(uintptr(enc) - pkt.m_nBytesRead = C.uint(math.Abs(float64(uintptr(enc) -
uintptr(unsafe.Pointer(pkt.m_body))))) uintptr(unsafe.Pointer(pkt.m_body)))))
@ -204,7 +208,9 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
s2 -= num s2 -= num
buf = incPtr(buf,num) buf = incPtr(buf,num)
if pkt.m_nBytesRead == pkt.m_nBodySize { if pkt.m_nBytesRead == pkt.m_nBodySize {
// TODO: Port this
ret = int(C.RTMP_SendPacket(r, pkt, 0)) ret = int(C.RTMP_SendPacket(r, pkt, 0))
// TODO: Port this
C.RTMPPacket_Free(pkt) C.RTMPPacket_Free(pkt)
pkt.m_nBytesRead = 0 pkt.m_nBytesRead = 0
if ret == 0 { if ret == 0 {