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; }
void OutboundConnectivity::SignalDetachedFromInStream() { BaseProtocol *pProtocol = ProtocolManager::GetProtocol(_rtpClient.protocolId); if (pProtocol != NULL) { pProtocol->EnqueueForDelete(); } _pRTSPProtocol = NULL; }
void AppleStreamingClientApplication::SignalStreamUnRegistered(BaseStream *pStream) { if (pStream->GetType() != ST_IN_NET_TS) return; BaseProtocol *pProtocol = pStream->GetProtocol(); if (pProtocol == NULL) { ASSERT("Protocol is NULL!!!"); } uint32_t contextId = pProtocol->GetCustomParameters()["contextId"]; ClientContext *pContext = ClientContext::GetContext(contextId, 0, 0); if (pContext == NULL) { WARN("Context not available anymore"); pProtocol->EnqueueForDelete(); return; } pContext->SignalStreamUnRegistered(pStream); }
FOR_MAP(_clients, uint32_t, RTPClient, i) { BaseProtocol *pProtocol = ProtocolManager::GetProtocol(MAP_KEY(i)); if (pProtocol != NULL) pProtocol->EnqueueForDelete(); }