From 1b1843d2b6db622828609f5545032d9cabd3a7f3 Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 29 Jul 2018 21:13:40 +0930 Subject: [PATCH] Fixed my avQueue func - now using, tested and working --- rtmp/rtmp.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 53ed5491..c8e64699 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1496,7 +1496,8 @@ func rtmpSendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int { //txn = int(C.AMF_DecodeNumber((*C.char)(ptr))) txn = int(amfDecodeNumber((*byte)(ptr))) // TODO: port this - avQueue(&r.m_methodCalls, (*int)(unsafe.Pointer(&r.m_numCalls)), &method, txn) + avQueue(&r.m_methodCalls, (*int32)(unsafe.Pointer(&r.m_numCalls)), + &method, int32(txn)) //C.AV_queue(&r.m_methodCalls, (*C.int)(unsafe.Pointer(&r.m_numCalls)), &method, //C.int(txn)) } @@ -1563,26 +1564,26 @@ func sockBufSend(sb *C.RTMPSockBuf, buf *byte, l int32) int32 { } // TODO: port RTMP_METHOD -func avQueue(vals **C.RTMP_METHOD, num *int, av *C.AVal, txn int) { +func avQueue(vals **C.RTMP_METHOD, num *int32, av *C.AVal, txn int32) { if (*num & 0x0f) == 0 { // TODO: work out what to do with the realloc //*vals = (*C.RTMP_METHOD)(realloc(unsafe.Pointer(*vals), int((*num+16)* //int(unsafe.Sizeof(*(*vals)))))) - *vals = (*C.RTMP_METHOD)(C.realloc(unsafe.Pointer(*vals), C.size_t((*num+16)*int( - unsafe.Sizeof(*(*vals)))))) + *vals = (*C.RTMP_METHOD)(C.realloc(unsafe.Pointer(*vals), C.size_t((*num+16)* + int32(unsafe.Sizeof(*(*vals)))))) } tmp := C.malloc(C.size_t(av.av_len + 1)) //tmp := allocate(uintptr(av.av_len + 1)) memmove(tmp, unsafe.Pointer(av.av_val), uintptr(av.av_len)) *indxBytePtr(tmp, int(av.av_len)) = '\000' - (*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), *num, + (*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), int(*num), int(unsafe.Sizeof(*(*vals)))))).num = C.int(txn) - (*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), *num, + (*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), int(*num), int(unsafe.Sizeof(*(*vals)))))).name.av_len = av.av_len - (*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), *num, + (*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), int(*num), int(unsafe.Sizeof(*(*vals)))))).name.av_val = (*C.char)(tmp) - *num++ + (*num)++ } func amfEncodeNamedNumber(output *byte, outend *byte, strName *C.AVal, dVal float64) *byte {