From 4328f1853b785d34120ddc5daac5fa5679c2c423 Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 12 Aug 2018 21:04:14 +0930 Subject: [PATCH] Started porting HandlInvoke --- rtmp/rtmp.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 1a8785d7..eeda665b 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1818,6 +1818,7 @@ func C_RTMP_ClientPacket(r *C.RTMP, packet *C.RTMPPacket) int32 { //RTMP_Log(RTMP_LOGDEBUG, "%s, received: invoke %u bytes", __FUNCTION__,packet.m_nBodySize); if C.HandleInvoke(r, packet.m_body, C.uint(packet.m_nBodySize)) == 1 { + //if C_HandleInvoke(r, (*byte)(unsafe.Pointer(packet.m_body), uint32(packet.m_nBodySize)) == 1 { bHasMediaPacket = 2 } /* @@ -1905,6 +1906,45 @@ func C_HandleClientBW(r *C.RTMP, packet *C.RTMPPacket) { //r->m_nClientBW2); } +// int HandleInvoke(RTMP* r, const char* body, unsigned int nBodySize); +// rtmp.c +2912 +/* +func C_HandleInvoke(r *C.RTMP, body *byte, nBodySize uint32) int32 { + var obj C.AMFObject + var method C.AVal + var txn float32 + var ret int32 = 0 + var nRes int32 + + if *body != 0x02 { + // TODO use new logger here + // RTMP_Log(RTMP_LOGWARNING, "%s, Sanity failed. no string method in invoke packet", + //__FUNCTION__); + return 0 + } + + nRes = C_AMF_Decode(&obj, body, nBodySize, 0) + + if nRes < 0 { + // TODO use new logger here + //RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__); + return 0 + } + + // TODO port this + C.AMF_Dump(&obj) + // TODO port this + C.AMFProp_GetString(C.AMF_GetProp(&obj, nil, 0),&method) + // TODO port this + txn = C.AMFProp_getNumber(C.AMF_GetProp(&obj, nil,1)) + // TODO use new logger here + // RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val); + + // TODO port this + if C.AVMATCH(&method, &av__result) +} +*/ + // void RTMPPacket_Free(RTMPPacket* p); // rtmp.c +203 func C_RTMPPacket_Free(p *C.RTMPPacket) {