From 0eb66a6ece366800c0c5fdd345ba93f92b8fb410 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Wed, 19 Sep 2018 14:05:42 +0930 Subject: [PATCH] rtmp: make C_HandleInvoke take a []byte --- rtmp/rtmp.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index d3670efb..8a8c7bb7 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -561,7 +561,7 @@ func C_RTMP_ClientPacket(r *C_RTMP, packet *C_RTMPPacket) int32 { // TODO use new logger here //RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %u bytes", __FUNCTION__,packet.m_nBodySize); - if C_HandleInvoke(r, packet.m_body, packet.m_nBodySize) { + if C_HandleInvoke(r, pl2b(packet.m_body, int(packet.m_nBodySize))) { // This will never happen with the methods we implement. log.Println("HasMediaPacket") bHasMediaPacket = 2 @@ -1016,15 +1016,15 @@ func C_AV_erase(m []C_RTMP_METHOD, i int) []C_RTMP_METHOD { // int HandleInvoke(RTMP* r, const char* body, unsigned int nBodySize); // rtmp.c +2912 -func C_HandleInvoke(r *C_RTMP, body *byte, nBodySize uint32) (ok bool) { - if *body != 0x02 { +func C_HandleInvoke(r *C_RTMP, body []byte) (ok bool) { + if body[0] != 0x02 { // TODO use new logger here //RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet", //__FUNCTION__); return false } var obj C_AMFObject - nRes := C_AMF_Decode(&obj, pl2b(body, int(nBodySize)), 0) + nRes := C_AMF_Decode(&obj, body, 0) if nRes < 0 { // TODO use new logger here //RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);