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__);
return 0
}
// TODO port this func
// TODO port AMF_Dump
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);
// TODO port this func
// TODO port AMFProp_GetNumber
txn = C.AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
// TODO use new logger here
// RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val);
switch{
case AVMATCH(&method, &av__result):
AVal methodInvoked = {0};
int i;
case C_AVMATCH(&method, &av__result):
var methodInvoked C.AVal
var i int32
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;
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;
}
}
if methodInvoked.av_val == 0 {
RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request",
__FUNCTION__, txn);
// TODO use new logger here
//RTMP_Log(RTMP_LOGDEBUG, "%s, received result id %f without matching request",
//__FUNCTION__, txn);
goto leave;
}
RTMP_Log(RTMP_LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__,
methodInvoked.av_val);
// TODO use new logger here
//RTMP_Log(RTMP_LOGDEBUG, "%s, received result for method call <%s>", __FUNCTION__,
//methodInvoked.av_val);
switch {
case AVMATCH(&methodInvoked, &av_connect):
if (r.Link.token.av_len){
AMFObjectProperty p;
if (RTMP_FindFirstMatchingProperty(&obj, &av_secureToken, &p)){
DecodeTEA(&r.Link.token, &p.p_vu.p_aval);
SendSecureTokenResponse(r, &p.p_vu.p_aval);
case C_AVMATCH(&methodInvoked, &av_connect):
if r.Link.token.av_len != 0 {
var p C.AMFObjectProperty
// TODO port this func
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){
SendReleaseStream(r);
SendFCPublish(r);
// TODO port this func
C.SendReleaseStream(r);
// TODO port this func
C.SendFCPublish(r);
}else{
RTMP_SendServerBW(r);
RTMP_SendCtrl(r, 3, 0, 300);
// TODO port this func
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 */
if (r.Link.usherToken.av_len){
SendUsherToken(r, &r.Link.usherToken);
if r.Link.usherToken.av_len != 0 {
// TODO port this func
C.SendUsherToken(r, &r.Link.usherToken);
}
/* Send the FCSubscribe if live stream or if subscribepath is set */
switch{
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:
SendFCSubscribe(r, &r.Link.playpath);
}
@ -2102,7 +2115,6 @@ func C_AVMATCH(a1, a2 C.AVal) int32 {
}
}
// void RTMPPacket_Free(RTMPPacket* p);
// rtmp.c +203
func C_RTMPPacket_Free(p *C.RTMPPacket) {