Marking functions that need to be ported

This commit is contained in:
saxon 2018-08-14 12:52:40 +09:30
parent ceb954a328
commit 96290d295d
1 changed files with 43 additions and 31 deletions

View File

@ -1929,62 +1929,75 @@ func C_HandleInvoke(r *C.RTMP, body *byte, nBodySize uint32) int32 {
//RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__); //RTMP_Log(RTMP_LOGERROR, "%s, error decoding invoke packet", __FUNCTION__);
return 0 return 0
} }
// TODO port this func // TODO port AMF_Dump
C.AMF_Dump(&obj); C.AMF_Dump(&obj);
// TODO port these two c funcs // TODO port AMFPRop_GetString
// TODO port AMF_GetProp
C.AMFProp_GetString(C.AMF_GetProp(&obj, NULL, 0), &method); C.AMFProp_GetString(C.AMF_GetProp(&obj, NULL, 0), &method);
// TODO port this func // TODO port AMFProp_GetNumber
txn = C.AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1)); txn = C.AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
// TODO use new logger here // TODO use new logger here
// RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val); // RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val);
switch{ switch{
case AVMATCH(&method, &av__result): case C_AVMATCH(&method, &av__result):
AVal methodInvoked = {0}; var methodInvoked C.AVal
int i; var i int32
for i=0; i < r.m_numCalls; i++ { for i=0; i < r.m_numCalls; i++ {
if (r.m_methodCalls[i].num == (int)txn) { if r.m_methodCalls[i].num == (int)txn {
methodInvoked = r.m_methodCalls[i].name; methodInvoked = r.m_methodCalls[i].name;
AV_erase(r.m_methodCalls, &r.m_numCalls, i, FALSE); // TODO port AV_erase
C.AV_erase(r.m_methodCalls, &r.m_numCalls, i, FALSE);
break; break;
} }
} }
if methodInvoked.av_val == 0 { if methodInvoked.av_val == 0 {
RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request", // TODO use new logger here
__FUNCTION__, txn); //RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request",
//__FUNCTION__, txn);
goto leave; goto leave;
} }
// TODO use new logger here
RTMP_Log(RTMP_LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__, //RTMP_Log(RTMP_LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__,
methodInvoked.av_val); //methodInvoked.av_val);
switch { switch {
case AVMATCH(&methodInvoked, &av_connect): case C_AVMATCH(&methodInvoked, &av_connect):
if (r.Link.token.av_len){ if r.Link.token.av_len != 0 {
AMFObjectProperty p; var p C.AMFObjectProperty
if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p)){
DecodeTEA(&r.Link.token, &p.p_vu.p_aval); // TODO port this func
SendSecureTokenResponse(r, &p.p_vu.p_aval); if C.RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p){
// TODO port this func
C.DecodeTEA(&r.Link.token, &p.p_vu.p_aval);
// TODO port this func
C.SendSecureTokenResponse(r, &p.p_vu.p_aval);
} }
} }
if (r.Link.protocol & RTMP_FEATURE_WRITE){ if (r.Link.protocol & RTMP_FEATURE_WRITE){
SendReleaseStream(r); // TODO port this func
SendFCPublish(r); C.SendReleaseStream(r);
// TODO port this func
C.SendFCPublish(r);
}else{ }else{
RTMP_SendServerBW(r); // TODO port this func
RTMP_SendCtrl(r, 3, 0, 300); C.RTMP_SendServerBW(r);
// TODO port this func
C.RTMP_SendCtrl(r, 3, 0, 300);
} }
RTMP_SendCreateStream(r); // TODO port this func
C.RTMP_SendCreateStream(r);
if (!(r.Link.protocol & RTMP_FEATURE_WRITE)){ if (r.Link.protocol & RTMP_FEATURE_WRITE) == 0 {
/* Authenticate on Justin.tv legacy servers before sending FCSubscribe */ /* Authenticate on Justin.tv legacy servers before sending FCSubscribe */
if (r.Link.usherToken.av_len){ if r.Link.usherToken.av_len != 0 {
SendUsherToken(r, &r.Link.usherToken); // TODO port this func
C.SendUsherToken(r, &r.Link.usherToken);
} }
/* Send the FCSubscribe if live stream or if subscribepath is set */ /* Send the FCSubscribe if live stream or if subscribepath is set */
switch{ switch{
case r.Link.subscribepath.av_len: case r.Link.subscribepath.av_len:
SendFCSubscribe(r, &r.Link.subscribepath); // TODO port
C.SendFCSubscribe(r, &r.Link.subscribepath);
case r.Link.lFlags & RTMP_LF_LIV: case r.Link.lFlags & RTMP_LF_LIV:
SendFCSubscribe(r, &r.Link.playpath); SendFCSubscribe(r, &r.Link.playpath);
} }
@ -2102,7 +2115,6 @@ func C_AVMATCH(a1, a2 C.AVal) int32 {
} }
} }
// 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) {