removed printf, removed random copy of some file

This commit is contained in:
wangyix 2014-08-08 11:22:04 -07:00
parent 8183fd3199
commit b670226ee3
2 changed files with 0 additions and 70 deletions

View file

@ -284,15 +284,6 @@ void InboundAudioStream::setSettings(const Settings& settings) {
setWindowStarveThreshold(settings._windowStarveThreshold);
setWindowSecondsForDesiredCalcOnTooManyStarves(settings._windowSecondsForDesiredCalcOnTooManyStarves);
setWindowSecondsForDesiredReduction(settings._windowSecondsForDesiredReduction);
printf("\n\nmax frames over desired: %d\n", settings._maxFramesOverDesired);
printf("dynamic jitter buffers: %d\n", settings._dynamicJitterBuffers);
printf("static desired jbuffer frames: %d\n", settings._staticDesiredJitterBufferFrames);
printf("use stdev: %d\n", settings._useStDevForJitterCalc);
printf("starve threshold: %d\n", settings._windowStarveThreshold);
printf("window A seconds: %d\n", settings._windowSecondsForDesiredCalcOnTooManyStarves);
printf("window B seconds: %d\n", settings._windowSecondsForDesiredReduction);
}
void InboundAudioStream::setDynamicJitterBuffers(bool dynamicJitterBuffers) {

View file

@ -1,61 +0,0 @@
//
// MovingPercentile.cpp
// libraries/shared/src
//
// Created by Yixin Wang on 6/4/2014
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "MovingPercentile.h"
MovingPercentile::MovingPercentile(int numSamples, float percentile)
: _numSamples(numSamples),
_percentile(percentile),
_samplesSorted(),
_sampleIds(),
_newSampleId(0),
_indexOfPercentile(0),
_valueAtPercentile(0.0f)
{
}
void MovingPercentile::updatePercentile(float sample) {
// insert the new sample into _samplesSorted
int newSampleIndex;
if (_samplesSorted.size() < _numSamples) {
// if not all samples have been filled yet, simply append it
newSampleIndex = _samplesSorted.size();
_samplesSorted.append(sample);
_sampleIds.append(_newSampleId);
// update _indexOfPercentile
float index = _percentile * (float)(_samplesSorted.size() - 1);
_indexOfPercentile = (int)(index + 0.5f); // round to int
} else {
// find index of sample with id = _newSampleId and replace it with new sample
newSampleIndex = _sampleIds.indexOf(_newSampleId);
_samplesSorted[newSampleIndex] = sample;
}
// increment _newSampleId. cycles from 0 thru N-1
_newSampleId = (_newSampleId == _numSamples - 1) ? 0 : _newSampleId + 1;
// swap new sample with neighbors in _samplesSorted until it's in sorted order
// try swapping up first, then down. element will only be swapped one direction.
while (newSampleIndex < _samplesSorted.size() - 1 && sample > _samplesSorted[newSampleIndex + 1]) {
_samplesSorted.swap(newSampleIndex, newSampleIndex + 1);
_sampleIds.swap(newSampleIndex, newSampleIndex + 1);
newSampleIndex++;
}
while (newSampleIndex > 0 && sample < _samplesSorted[newSampleIndex - 1]) {
_samplesSorted.swap(newSampleIndex, newSampleIndex - 1);
_sampleIds.swap(newSampleIndex, newSampleIndex - 1);
newSampleIndex--;
}
// find new value at percentile
_valueAtPercentile = _samplesSorted[_indexOfPercentile];
}