remove mixer smart thresholding for flange testing

This commit is contained in:
Stephen Birarda 2013-03-12 12:15:14 -07:00
parent 5bc08fa167
commit 28ac0cbdfc

View file

@ -21,7 +21,7 @@ const unsigned short MIXER_LISTEN_PORT = 55443;
const float SAMPLE_RATE = 22050.0;
const short JITTER_BUFFER_MSECS = 12;
const short JITTER_BUFFER_MSECS = 5;
const short JITTER_BUFFER_SAMPLES = JITTER_BUFFER_MSECS * (SAMPLE_RATE / 1000.0);
const int BUFFER_LENGTH_BYTES = 1024;
@ -81,22 +81,6 @@ void *sendBuffer(void *args)
printf("Buffer %d starved.\n", i);
agentBuffer->setStarted(false);
} else {
// check if we have more than we need to play out
int thresholdFrames = ceilf((BUFFER_LENGTH_SAMPLES_PER_CHANNEL + JITTER_BUFFER_SAMPLES) / (float)BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
int thresholdSamples = thresholdFrames * BUFFER_LENGTH_SAMPLES_PER_CHANNEL;
if (agentBuffer->diffLastWriteNextOutput() > thresholdSamples) {
// we need to push the next output forwards
int samplesToPush = agentBuffer->diffLastWriteNextOutput() - thresholdSamples;
if (agentBuffer->getNextOutput() + samplesToPush > agentBuffer->getBuffer()) {
agentBuffer->setNextOutput(agentBuffer->getBuffer() + (samplesToPush - (agentBuffer->getBuffer() + RING_BUFFER_SAMPLES - agentBuffer->getNextOutput())));
} else {
agentBuffer->setNextOutput(agentBuffer->getNextOutput() + samplesToPush);
}
}
// good buffer, add this to the mix
agentBuffer->setStarted(true);
agentBuffer->setAddedToMix(true);