From 60b88dbf6cab360e08ffdf9f2f6ccbde358f3def Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 29 Jul 2018 10:21:53 +0930 Subject: [PATCH] Using my amfEncodeNamedBoolean and amfEncodeBoolean - tested and working --- rtmp/rtmp.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 64349a89..f30759ec 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1014,9 +1014,9 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int { } if r.Link.protocol&RTMP_FEATURE_WRITE == 0 { - enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedBoolean((*C.char)( - unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_fpad, 0))) - // enc = amfEncodeNamedBoolean(enc, pend, &av_fpad, 0) + //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedBoolean((*C.char)( + //unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_fpad, 0))) + enc = amfEncodeNamedBoolean(enc, pend, &av_fpad, 0) if enc == nil { return 0 } @@ -1598,7 +1598,7 @@ func amfEncodeNamedBoolean(output *byte, outend *byte, strName *C.AVal, bVal int return nil } output = amfEncodeInt16(output, outend, int16(strName.av_len)) - memmove(unsafe.Pointer(output), unsafe.Pointer(outend), uintptr(strName.av_len)) + memmove(unsafe.Pointer(output), unsafe.Pointer(strName.av_val), uintptr(strName.av_len)) output = (*byte)(incBytePtr(unsafe.Pointer(output), int(strName.av_len))) return amfEncodeBoolean(output, outend, bVal) } @@ -1607,13 +1607,14 @@ func amfEncodeBoolean(output *byte, outend *byte, bVal int) *byte { if int(uintptr(unsafe.Pointer(output)))+2 > int(uintptr(unsafe.Pointer(outend))) { return nil } - *(*byte)(unsafe.Pointer(output)) = C.AMF_BOOLEAN + *(*byte)(unsafe.Pointer(output)) = AMF_BOOLEAN output = (*byte)(incBytePtr(unsafe.Pointer(output), 1)) val := byte(0x01) if bVal == 0 { val = byte(0x00) } *(*byte)(unsafe.Pointer(output)) = val + output = (*byte)(incBytePtr(unsafe.Pointer(output), 1)) return output }