Merge pull request #559 from jolavillette/PacketSlicingGroupingFlags

Create 2 #define in pqistreamer to easily disable packet slicing/grouping
This commit is contained in:
Cyril Soler 2016-11-05 21:09:49 +01:00 committed by GitHub
commit 17fb682c8d

View File

@ -64,6 +64,10 @@ static const int PQISTREAM_PACKET_SLICING_PROBE_DELAY = 60; // send every 6
static uint8_t PACKET_SLICING_PROBE_BYTES[8] = { 0x02, 0xaa, 0xbb, 0xcc, 0x00, 0x00, 0x00, 0x08 } ; static uint8_t PACKET_SLICING_PROBE_BYTES[8] = { 0x02, 0xaa, 0xbb, 0xcc, 0x00, 0x00, 0x00, 0x08 } ;
/* Change to true to disable packet slicing and/or packet grouping, if needed */
#define DISABLE_PACKET_SLICING false
#define DISABLE_PACKET_GROUPING false
/* This removes the print statements (which hammer pqidebug) */ /* This removes the print statements (which hammer pqidebug) */
/*** /***
#define RSITEM_DEBUG 1 #define RSITEM_DEBUG 1
@ -629,7 +633,7 @@ int pqistreamer::handleoutgoing_locked()
++k ; ++k ;
} }
} }
while(mPkt_wpending_size < (uint32_t)maxbytes && mPkt_wpending_size < PQISTREAM_OPTIMAL_PACKET_SIZE ) ; while(mPkt_wpending_size < (uint32_t)maxbytes && mPkt_wpending_size < PQISTREAM_OPTIMAL_PACKET_SIZE && !DISABLE_PACKET_GROUPING) ;
#ifdef DEBUG_PQISTREAMER #ifdef DEBUG_PQISTREAMER
if(k > 1) if(k > 1)
@ -787,7 +791,7 @@ start_packet_read:
if(!memcmp(block,PACKET_SLICING_PROBE_BYTES,8)) if(!memcmp(block,PACKET_SLICING_PROBE_BYTES,8))
{ {
mAcceptsPacketSlicing = true ; mAcceptsPacketSlicing = !DISABLE_PACKET_SLICING;
#ifdef DEBUG_PACKET_SLICING #ifdef DEBUG_PACKET_SLICING
std::cerr << "(II) Enabling packet slicing!" << std::endl; std::cerr << "(II) Enabling packet slicing!" << std::endl;
#endif #endif
@ -815,7 +819,7 @@ continue_packet:
#endif #endif
is_partial_packet = true ; is_partial_packet = true ;
mAcceptsPacketSlicing = true ; // this is needed mAcceptsPacketSlicing = !DISABLE_PACKET_SLICING; // this is needed
} }
else else
extralen = getRsItemSize(block) - blen; // old style packet type extralen = getRsItemSize(block) - blen; // old style packet type