Started porting HandlInvoke

This commit is contained in:
saxon 2018-08-12 21:04:14 +09:30
parent 74735feb63
commit 4328f1853b
1 changed files with 40 additions and 0 deletions

View File

@ -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); //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, 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 bHasMediaPacket = 2
} }
/* /*
@ -1905,6 +1906,45 @@ func C_HandleClientBW(r *C.RTMP, packet *C.RTMPPacket) {
//r->m_nClientBW2); //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); // void RTMPPacket_Free(RTMPPacket* p);
// rtmp.c +203 // rtmp.c +203
func C_RTMPPacket_Free(p *C.RTMPPacket) { func C_RTMPPacket_Free(p *C.RTMPPacket) {