condensed front() and pop() into pop()

unstable
Tom Early 4 years ago
parent 048bb6d9ba
commit 197fb2c166

@ -181,9 +181,8 @@ void CCodecStream::Task(void)
// pop the original packet // pop the original packet
if ( !m_LocalQueue.empty() ) if ( !m_LocalQueue.empty() )
{ {
auto Packet = m_LocalQueue.front(); auto Packet = m_LocalQueue.pop();
auto Frame = (CDvFramePacket *)Packet.get(); auto Frame = (CDvFramePacket *)Packet.get();
m_LocalQueue.pop();
// todo: check the PID // todo: check the PID
// update content with transcoded ambe // update content with transcoded ambe
Frame->SetAmbe(m_uiCodecOut, Ambe); Frame->SetAmbe(m_uiCodecOut, Ambe);
@ -208,9 +207,8 @@ void CCodecStream::Task(void)
while ( !empty() ) while ( !empty() )
{ {
// yes, pop it from queue // yes, pop it from queue
auto Packet = front(); auto Packet = pop();
auto Frame = (CDvFramePacket *)Packet.get(); auto Frame = (CDvFramePacket *)Packet.get();
pop();
// yes, send to ambed // yes, send to ambed
// this assume that thread pushing the Packet // this assume that thread pushing the Packet

@ -232,8 +232,7 @@ void CDcsProtocol::HandleQueue(void)
while ( !m_Queue.empty() ) while ( !m_Queue.empty() )
{ {
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// get our sender's id // get our sender's id
int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId()); int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId());

@ -37,7 +37,7 @@ public:
~CDcsStreamCacheItem() {} ~CDcsStreamCacheItem() {}
CDvHeaderPacket m_dvHeader; CDvHeaderPacket m_dvHeader;
uint32_t m_iSeqCounter; uint32_t m_iSeqCounter;
}; };
class CDcsProtocol : public CProtocol class CDcsProtocol : public CProtocol

@ -223,8 +223,7 @@ void CDextraProtocol::HandleQueue(void)
while ( !m_Queue.empty() ) while ( !m_Queue.empty() )
{ {
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// encode it // encode it
CBuffer buffer; CBuffer buffer;

@ -351,8 +351,7 @@ void CDmrmmdvmProtocol::HandleQueue(void)
while ( !m_Queue.empty() ) while ( !m_Queue.empty() )
{ {
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// get our sender's id // get our sender's id
int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId()); int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId());

@ -224,8 +224,7 @@ void CDmrplusProtocol::HandleQueue(void)
while ( !m_Queue.empty() ) while ( !m_Queue.empty() )
{ {
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// get our sender's id // get our sender's id
int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId()); int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId());

@ -238,8 +238,7 @@ void CDplusProtocol::HandleQueue(void)
while ( !m_Queue.empty() ) while ( !m_Queue.empty() )
{ {
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// get our sender's id // get our sender's id
int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId()); int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId());

@ -452,8 +452,7 @@ void CG3Protocol::HandleQueue(void)
m_LastKeepaliveTime.start(); m_LastKeepaliveTime.start();
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// encode it // encode it
CBuffer buffer; CBuffer buffer;

@ -39,15 +39,14 @@ public:
void Unlock() { m_Mutex.unlock(); } void Unlock() { m_Mutex.unlock(); }
// pass thru // pass thru
void pop() { queue.pop(); } std::unique_ptr<CPacket> pop() { auto pack = std::move(queue.front()); queue.pop(); return std::move(pack); }
bool empty() const { return queue.empty(); } bool empty() const { return queue.empty(); }
std::unique_ptr<CPacket> front() { return std::move(queue.front()); }
void push(std::unique_ptr<CPacket> &packet) { queue.push(std::move(packet)); } void push(std::unique_ptr<CPacket> &packet) { queue.push(std::move(packet)); }
protected: protected:
// status // status
bool m_bOpen; bool m_bOpen;
uint16_t m_uiStreamId; uint16_t m_uiStreamId;
std::mutex m_Mutex; std::mutex m_Mutex;
// owner // owner

@ -283,8 +283,7 @@ void CReflector::RouterThread(CPacketStream *streamIn)
if ( !streamIn->empty() ) if ( !streamIn->empty() )
{ {
// get the packet // get the packet
packet = streamIn->front(); packet = streamIn->pop();
streamIn->pop();
} }
else else
{ {

@ -224,8 +224,7 @@ void CUlxProtocol::HandleQueue(void)
while ( !m_Queue.empty() ) while ( !m_Queue.empty() )
{ {
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// check if origin of packet is local // check if origin of packet is local
// if not, do not stream it out as it will cause // if not, do not stream it out as it will cause

@ -279,8 +279,7 @@ void CYsfProtocol::HandleQueue(void)
while ( !m_Queue.empty() ) while ( !m_Queue.empty() )
{ {
// get the packet // get the packet
auto packet = m_Queue.front(); auto packet = m_Queue.pop();
m_Queue.pop();
// get our sender's id // get our sender's id
int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId()); int iModId = g_Reflector.GetModuleIndex(packet->GetModuleId());

Loading…
Cancel
Save

Powered by TurnKey Linux.