Getting seg fault in avQueue

This commit is contained in:
saxon 2018-07-29 11:03:34 +09:30
parent 0fc985d1c5
commit 10667ba5f0
1 changed files with 5 additions and 4 deletions

View File

@ -1496,8 +1496,9 @@ 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
C.AV_queue(&r.m_methodCalls, (*C.int)(unsafe.Pointer(&r.m_numCalls)), &method,
C.int(txn))
avQueue(&r.m_methodCalls, (*int)(unsafe.Pointer(&r.m_numCalls)), &method, txn)
//C.AV_queue(&r.m_methodCalls, (*C.int)(unsafe.Pointer(&r.m_numCalls)), &method,
//C.int(txn))
}
}
@ -1570,8 +1571,8 @@ func avQueue(vals **C.RTMP_METHOD, num *int, av *C.AVal, txn int) {
*vals = (*C.RTMP_METHOD)(C.realloc(unsafe.Pointer(*vals), C.size_t((*num+16)*int(
unsafe.Sizeof(*(*vals))))))
}
//tmp := C.malloc(C.size_t(av.av_len + 1))
tmp := allocate(uintptr(av.av_len + 1))
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'