Variant StreamMessageFactory::GetInvokeFCSubscribe(string streamName) { Variant FCSubscribe; FCSubscribe.PushToArray(Variant()); FCSubscribe.PushToArray(streamName); return GenericMessageFactory::GetInvoke(3, 0, 0, false, 1, RM_INVOKE_FUNCTION_FCSUBSCRIBE, FCSubscribe); }
bool RTMPAppProtocolHandler::ProcessGetBWInfo(BaseRTMPProtocol *pFrom, Variant &request) { uint32_t contextId = pFrom->GetCustomParameters()["contextId"]; Variant response; Variant parameters; parameters.PushToArray(Variant()); parameters.PushToArray(Variant()); if (contextId == 0) { WARN("No context available yet"); response = GenericMessageFactory::GetInvokeResult(request, parameters); return SendRTMPMessage(pFrom, response); } ClientContext *pContext = ClientContext::GetContext(contextId, GetApplication()->GetId(), pFrom->GetType()); if (pContext == NULL) { FATAL("Unable to get context"); return false; } ASC_RES_BUILD_OK_INFO_BANDWIDTH(parameters[(uint32_t) 1], pContext->GetAvailableBandwidths(), pContext->GetDetectedBandwidth(), pContext->GetSelectedBandwidth(), pContext->GetBufferLevel(), pContext->GetMaxBufferLevel(), pContext->GetBufferLevelPercent()); response = GenericMessageFactory::GetInvokeResult(request, parameters); return SendRTMPMessage(pFrom, response); }
bool PopStack(lua_State *pLuaState, Variant &variant) { variant.Reset(); variant.IsArray(true); while (lua_gettop(pLuaState) > 0) { Variant temp; if (!PopVariant(pLuaState, temp)) { FATAL("Unable to pop variant"); return false; } variant.PushToArray(temp); } return true; }