BM is just a regular client

unstable
Tom Early 4 years ago
parent 8f17609245
commit 2070e9e537

@ -198,52 +198,46 @@ void CBMProtocol::HandleQueue(void)
// get the packet // get the packet
auto packet = m_Queue.pop(); auto packet = m_Queue.pop();
// check if origin of packet is local // encode it
// if not, do not stream it out as it will cause CBuffer buffer;
// network loop between linked XLX peers if ( EncodeDvPacket(*packet, buffer) )
if ( packet->IsLocalOrigin() )
{ {
// encode it // encode revision dependent version
CBuffer buffer; CBuffer bufferLegacy = buffer;
if ( EncodeDvPacket(*packet, buffer) ) if ( packet->IsDvFrame() && (bufferLegacy.size() == 45) )
{ {
// encode revision dependent version bufferLegacy.resize(27);
CBuffer bufferLegacy = buffer; }
if ( packet->IsDvFrame() && (bufferLegacy.size() == 45) )
{
bufferLegacy.resize(27);
}
// and push it to all our clients linked to the module and who are not streaming in // and push it to all our clients linked to the module and who are not streaming in
CClients *clients = g_Reflector.GetClients(); CClients *clients = g_Reflector.GetClients();
auto it = clients->begin(); auto it = clients->begin();
std::shared_ptr<CClient>client = nullptr; std::shared_ptr<CClient>client = nullptr;
while ( (client = clients->FindNextClient(EProtocol::bm, it)) != nullptr ) while ( (client = clients->FindNextClient(EProtocol::bm, it)) != nullptr )
{
// is this client busy ?
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetPacketModule()) )
{ {
// is this client busy ? // no, send the packet
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetPacketModule()) ) // this is protocol revision dependent
switch ( client->GetProtocolRevision() )
{ {
// no, send the packet case EProtoRev::original:
// this is protocol revision dependent case EProtoRev::revised:
switch ( client->GetProtocolRevision() ) Send(bufferLegacy, client->GetIp());
{ break;
case EProtoRev::original: case EProtoRev::ambe:
case EProtoRev::revised: default:
Send(bufferLegacy, client->GetIp());
break;
case EProtoRev::ambe:
default:
#ifdef TRANSCODED_MODULES #ifdef TRANSCODED_MODULES
Send(buffer, client->GetIp()); Send(buffer, client->GetIp());
#else #else
Send(bufferLegacy, client->GetIp()); Send(bufferLegacy, client->GetIp());
#endif #endif
break; break;
}
} }
} }
g_Reflector.ReleaseClients();
} }
g_Reflector.ReleaseClients();
} }
} }
m_Queue.Unlock(); m_Queue.Unlock();
@ -351,9 +345,6 @@ void CBMProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header, c
// todo: verify Packet.GetModuleId() is in authorized list of XLX of origin // todo: verify Packet.GetModuleId() is in authorized list of XLX of origin
// todo: do the same for DVFrame and DVLAstFrame packets // todo: do the same for DVFrame and DVLAstFrame packets
// tag packet as remote peer origin
Header->SetRemotePeerOrigin();
// find the stream // find the stream
auto stream = GetStream(Header->GetStreamId()); auto stream = GetStream(Header->GetStreamId());
if ( stream ) if ( stream )
@ -389,15 +380,6 @@ void CBMProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header, c
} }
} }
void CBMProtocol::OnDvFramePacketIn(std::unique_ptr<CDvFramePacket> &DvFrame, const CIp *Ip)
{
// tag packet as remote peer origin
DvFrame->SetRemotePeerOrigin();
// anc call base class
CProtocol::OnDvFramePacketIn(DvFrame, Ip);
}
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// packet decoding helpers // packet decoding helpers

@ -49,7 +49,6 @@ protected:
// stream helpers // stream helpers
void OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &, const CIp &); void OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &, const CIp &);
void OnDvFramePacketIn(std::unique_ptr<CDvFramePacket> &, const CIp * = nullptr);
// packet decoding helpers // packet decoding helpers
bool IsValidDvHeaderPacket(const CBuffer &, std::unique_ptr<CDvHeaderPacket> &); bool IsValidDvHeaderPacket(const CBuffer &, std::unique_ptr<CDvHeaderPacket> &);

Loading…
Cancel
Save

Powered by TurnKey Linux.