Esempio n. 1
0
BaseProtocol *InboundHTTP4RTMP::Bind(string sid) {
	BaseProtocol *pResult = NULL;
	if (_pNearProtocol == NULL) {
		//14. This might be a new connection. Do we have that sid generated?
		if (!MAP_HAS1(_generatedSids, sid)) {
			FATAL("Invalid sid: %s", STR(sid));
			return false;
		}

		//15. See if we have to generate a new connection or we just pick up
		//a disconnected one
		if (MAP_HAS1(_protocolsBySid, sid)) {
			pResult = ProtocolManager::GetProtocol(_protocolsBySid[sid]);
		} else {
			pResult = new InboundRTMPProtocol();
			pResult->Initialize(GetCustomParameters());
			pResult->SetApplication(GetApplication());
			_protocolsBySid[sid] = pResult->GetId();
			SetNearProtocol(pResult);
			pResult->SetFarProtocol(this);
		}
	} else {
		pResult = _pNearProtocol;
	}

	return pResult;
}
bool InboundRTMPSDiscriminatorProtocol::BindSSL(IOBuffer &buffer) {
	//1. Create the RTMP protocol
	BaseProtocol *pRTMP = new InboundRTMPProtocol();
	if (!pRTMP->Initialize(GetCustomParameters())) {
		FATAL("Unable to create RTMP protocol");
		pRTMP->EnqueueForDelete();
		return false;
	}

	//2. Destroy the link
	BaseProtocol *pFar = _pFarProtocol;
	pFar->ResetNearProtocol();
	ResetFarProtocol();

	//3. Create the new links
	pFar->SetNearProtocol(pRTMP);
	pRTMP->SetFarProtocol(pFar);

	//4. Set the application
	pRTMP->SetApplication(GetApplication());

	//5. Enqueue for delete this protocol
	EnqueueForDelete();

	//6. Process the data
	if (!pRTMP->SignalInputData(buffer)) {
		FATAL("Unable to process data");
		pRTMP->EnqueueForDelete();
	}

	return true;
}
bool InboundMJPGHTTPStreamProtocol::Initialize(Variant &parameters) {
	if ((parameters["crossDomainFile"] != V_STRING)
			|| (parameters["crossDomainFile"] == "")) {
		FATAL("crossDomainFile not specified");
		return false;
	}
	GetCustomParameters() = parameters;
	_crossDomainFile = (string) parameters["crossDomainFile"];
	return true;
}
Esempio n. 4
0
bool RTSPProtocol::Initialize(Variant &parameters) {
  GetCustomParameters() = parameters;
  return true;
}
Esempio n. 5
0
bool InboundHTTP4RTMP::Initialize(Variant &parameters) {
	GetCustomParameters()=parameters;
	return true;
}
bool InboundRTMPSDiscriminatorProtocol::Initialize(Variant &parameters) {
	GetCustomParameters() = parameters;
	return true;
}
Esempio n. 7
0
bool NATTraversalProtocol::Initialize(Variant &parameters) {
	GetCustomParameters() = parameters;
	return true;
}