output difference in time since last send for debug

This commit is contained in:
Stephen Birarda 2013-02-04 17:11:34 -08:00
parent 8035471fa4
commit 0cfc2dae52

View file

@ -144,6 +144,7 @@ void *send_buffer_thread(void *args)
int sentBytes; int sentBytes;
int currentFrame = 1; int currentFrame = 1;
timeval startTime; timeval startTime;
timeval lastSend;
timeval now; timeval now;
int16_t *clientMix = new int16_t[BUFFER_LENGTH_SAMPLES]; int16_t *clientMix = new int16_t[BUFFER_LENGTH_SAMPLES];
@ -157,6 +158,8 @@ void *send_buffer_thread(void *args)
while (usecTimestamp(&startTime, (currentFrame * BUFFER_SEND_INTERVAL_USECS)) <= usecTimestamp(&now)) { while (usecTimestamp(&startTime, (currentFrame * BUFFER_SEND_INTERVAL_USECS)) <= usecTimestamp(&now)) {
sentBytes = 0; sentBytes = 0;
std::cout << "The difference was " << diffclock(lastSend, now) << "ms.\n";
int sampleOffset = ((currentFrame - 1) * BUFFER_LENGTH_SAMPLES) % whiteNoiseLength; int sampleOffset = ((currentFrame - 1) * BUFFER_LENGTH_SAMPLES) % whiteNoiseLength;
memcpy(masterMix, whiteNoiseBuffer + sampleOffset, BUFFER_LENGTH_BYTES); memcpy(masterMix, whiteNoiseBuffer + sampleOffset, BUFFER_LENGTH_BYTES);
@ -193,6 +196,7 @@ void *send_buffer_thread(void *args)
} }
} }
gettimeofday(&lastSend, NULL);
currentFrame++; currentFrame++;
} }
} }