Properly flush the DU queue when we hit the limit. Fixes extreme lag that occurs after streaming for a bit.

This commit is contained in:
Cameron Gutman
2014-08-30 17:07:08 -07:00
parent dc926946dd
commit 0ee1609cc4
4 changed files with 49 additions and 16 deletions
+12 -7
View File
@@ -28,13 +28,8 @@ void initializeAudioStream(IP_ADDRESS host, PAUDIO_RENDERER_CALLBACKS arCallback
LbqInitializeLinkedBlockingQueue(&packetQueue, 30);
}
/* Tear down the audio stream once we're done with it */
void destroyAudioStream(void) {
PLINKED_BLOCKING_QUEUE_ENTRY entry, nextEntry;
callbacks.release();
entry = LbqDestroyLinkedBlockingQueue(&packetQueue);
static void freePacketList(PLINKED_BLOCKING_QUEUE_ENTRY entry) {
PLINKED_BLOCKING_QUEUE_ENTRY nextEntry;
while (entry != NULL) {
nextEntry = entry->flink;
@@ -44,6 +39,15 @@ void destroyAudioStream(void) {
}
}
/* Tear down the audio stream once we're done with it */
void destroyAudioStream(void) {
callbacks.release();
freePacketList(LbqDestroyLinkedBlockingQueue(&packetQueue));
}
static void UdpPingThreadProc(void *context) {
/* Ping in ASCII */
char pingData[] = { 0x50, 0x49, 0x4E, 0x47 };
@@ -112,6 +116,7 @@ static void ReceiveThreadProc(void* context) {
if (err == LBQ_BOUND_EXCEEDED) {
Limelog("Audio packet queue overflow\n");
freePacketList(LbqFlushQueueItems(&packetQueue));
}
else if (err == LBQ_INTERRUPTED) {
Limelog("Receive thread terminating #2\n");