mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 01:04:06 +02:00
removed debug code
This commit is contained in:
parent
7196814ec3
commit
e5d7d471e3
6 changed files with 10 additions and 49 deletions
|
@ -90,7 +90,6 @@ int AudioMixerClientData::parseData(const QByteArray& packet) {
|
|||
// we don't have a matching injected audio ring buffer, so add it
|
||||
matchingInjectedRingBuffer = new InjectedAudioRingBuffer(streamIdentifier);
|
||||
_ringBuffers.push_back(matchingInjectedRingBuffer);
|
||||
printf("created InjectedRingBuffer %p\n", (void*)matchingInjectedRingBuffer);
|
||||
}
|
||||
|
||||
matchingInjectedRingBuffer->parseData(packet);
|
||||
|
@ -133,7 +132,6 @@ void AudioMixerClientData::pushBuffersAfterFrameSend() {
|
|||
&& audioBuffer->hasStarted() && audioBuffer->isStarved()) {
|
||||
// this is an empty audio buffer that has starved, safe to delete
|
||||
delete audioBuffer;
|
||||
printf("deleted injector %p\n", (void*)audioBuffer);
|
||||
i = _ringBuffers.erase(i);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -622,7 +622,6 @@ void Audio::handleAudioInput() {
|
|||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
|
||||
if (audioMixer && audioMixer->getActiveSocket()) {
|
||||
|
||||
MyAvatar* interfaceAvatar = Application::getInstance()->getAvatar();
|
||||
glm::vec3 headPosition = interfaceAvatar->getHead()->getPosition();
|
||||
glm::quat headOrientation = interfaceAvatar->getHead()->getFinalOrientationInWorldFrame();
|
||||
|
@ -639,7 +638,6 @@ void Audio::handleAudioInput() {
|
|||
numAudioBytes = sizeof(int16_t);
|
||||
} else {
|
||||
numAudioBytes = numNetworkBytes;
|
||||
//_isStereoInput ? NETWORK_BUFFER_LENGTH_BYTES_STEREO : NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL;
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::EchoServerAudio)) {
|
||||
packetType = PacketTypeMicrophoneAudioWithEcho;
|
||||
|
|
|
@ -124,13 +124,8 @@ qint64 AudioRingBuffer::writeData(const char* data, qint64 maxSize) {
|
|||
|
||||
std::less<int16_t*> less;
|
||||
std::less_equal<int16_t*> lessEqual;
|
||||
|
||||
// TODO: why is less(_endOfLastWrite, _nextOutput) a condition here?
|
||||
if (_hasStarted
|
||||
/*
|
||||
&& (less(_endOfLastWrite, _nextOutput)
|
||||
&& lessEqual(_nextOutput, shiftedPositionAccomodatingWrap(_endOfLastWrite, samplesToCopy)))*/
|
||||
&& samplesToCopy > _sampleCapacity - samplesAvailable()) {
|
||||
|
||||
if (_hasStarted && samplesToCopy > _sampleCapacity - samplesAvailable()) {
|
||||
// this read will cross the next output, so call us starved and reset the buffer
|
||||
qDebug() << "Filled the ring buffer. Resetting.";
|
||||
_endOfLastWrite = _buffer;
|
||||
|
@ -147,8 +142,7 @@ qint64 AudioRingBuffer::writeData(const char* data, qint64 maxSize) {
|
|||
}
|
||||
|
||||
_endOfLastWrite = shiftedPositionAccomodatingWrap(_endOfLastWrite, samplesToCopy);
|
||||
|
||||
printf("%p: writeData. %d samples available\n", (void*)this, samplesAvailable());
|
||||
|
||||
return samplesToCopy * sizeof(int16_t);
|
||||
}
|
||||
|
||||
|
@ -162,7 +156,6 @@ const int16_t& AudioRingBuffer::operator[] (const int index) const {
|
|||
|
||||
void AudioRingBuffer::shiftReadPosition(unsigned int numSamples) {
|
||||
_nextOutput = shiftedPositionAccomodatingWrap(_nextOutput, numSamples);
|
||||
printf("%p: mixed. %d samples remaining\n", (void*)this, samplesAvailable());
|
||||
}
|
||||
|
||||
unsigned int AudioRingBuffer::samplesAvailable() const {
|
||||
|
|
|
@ -74,14 +74,13 @@ public:
|
|||
bool hasStarted() const { return _hasStarted; }
|
||||
|
||||
void addSilentFrame(int numSilentSamples);
|
||||
|
||||
protected:
|
||||
// disallow copying of AudioRingBuffer objects
|
||||
AudioRingBuffer(const AudioRingBuffer&);
|
||||
AudioRingBuffer& operator= (const AudioRingBuffer&);
|
||||
|
||||
int16_t* shiftedPositionAccomodatingWrap(int16_t* position, int numSamplesShift) const;
|
||||
|
||||
|
||||
int _sampleCapacity;
|
||||
int _numFrameSamples;
|
||||
int16_t* _nextOutput;
|
||||
|
|
|
@ -33,12 +33,9 @@ InterframeTimeGapHistory::InterframeTimeGapHistory()
|
|||
}
|
||||
|
||||
void InterframeTimeGapHistory::frameReceived() {
|
||||
|
||||
static quint64 gapsSum = 0;
|
||||
|
||||
quint64 now = usecTimestampNow();
|
||||
|
||||
// make sure this isn't the first time frameReceived() is called, meaning there's actually a gap to calculate.
|
||||
// make sure this isn't the first time frameReceived() is called so can actually calculate a gap.
|
||||
if (_lastFrameReceivedTime != 0) {
|
||||
quint64 gap = now - _lastFrameReceivedTime;
|
||||
|
||||
|
@ -123,7 +120,6 @@ int PositionalAudioRingBuffer::parseData(const QByteArray& packet) {
|
|||
readBytes += sizeof(int16_t);
|
||||
|
||||
if (numSilentSamples > 0) {
|
||||
|
||||
if (_currentJitterBufferFrames > _desiredJitterBufferFrames) {
|
||||
// our current jitter buffer size exceeds its desired value, so ignore some silent
|
||||
// frames to get that size as close to desired as possible
|
||||
|
@ -140,7 +136,6 @@ int PositionalAudioRingBuffer::parseData(const QByteArray& packet) {
|
|||
} else {
|
||||
// we need to drop all frames to get the jitter buffer close as possible to its desired length
|
||||
_currentJitterBufferFrames -= numSilentFrames;
|
||||
printf("dropped silent packet! jbuffer size is now %d ###############\n", _currentJitterBufferFrames);
|
||||
}
|
||||
} else {
|
||||
addSilentFrame(numSilentSamples);
|
||||
|
@ -148,8 +143,7 @@ int PositionalAudioRingBuffer::parseData(const QByteArray& packet) {
|
|||
}
|
||||
} else {
|
||||
// there is audio data to read
|
||||
int dataBytes = writeData(packet.data() + readBytes, packet.size() - readBytes);
|
||||
readBytes += dataBytes;
|
||||
readBytes += writeData(packet.data() + readBytes, packet.size() - readBytes);
|
||||
}
|
||||
return readBytes;
|
||||
}
|
||||
|
@ -200,12 +194,7 @@ bool PositionalAudioRingBuffer::shouldBeAddedToMix() {
|
|||
int samplesPerFrame = getSamplesPerFrame();
|
||||
int desiredJitterBufferSamples = _desiredJitterBufferFrames * samplesPerFrame;
|
||||
|
||||
//printf("\nsamples available: %d frames available: %d\n", samplesAvailable(), samplesAvailable() / samplesPerFrame);
|
||||
if (!isNotStarvedOrHasMinimumSamples(samplesPerFrame + desiredJitterBufferSamples)) {
|
||||
|
||||
printf("\nMIXING DELAYED! waiting for jitter buffer to fill after being starved\n");
|
||||
printf("samples available: %d frames available: %d\n", samplesAvailable(), samplesAvailable() / samplesPerFrame);
|
||||
|
||||
// if the buffer was starved, allow it to accrue at least the desired number of
|
||||
// jitter buffer frames before we start taking frames from it for mixing
|
||||
|
||||
|
@ -214,15 +203,10 @@ printf("samples available: %d frames available: %d\n", samplesAvailable(), samp
|
|||
}
|
||||
|
||||
return false;
|
||||
|
||||
} else if (samplesAvailable() < samplesPerFrame) {
|
||||
|
||||
printf("\nMIXING DELAYED! jitter buffer is starved!!!\n");
|
||||
printf("samples available: %d frames available: %d\n", samplesAvailable(), samplesAvailable() / samplesPerFrame);
|
||||
|
||||
} else if (samplesAvailable() < samplesPerFrame) {
|
||||
// if the buffer doesn't have a full frame of samples to take for mixing, it is starved
|
||||
_isStarved = true;
|
||||
|
||||
|
||||
// set to 0 to indicate the jitter buffer is starved
|
||||
_currentJitterBufferFrames = 0;
|
||||
|
||||
|
@ -230,19 +214,13 @@ printf("samples available: %d frames available: %d\n", samplesAvailable(), samp
|
|||
_shouldOutputStarveDebug = true;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
//printf("WILL MIX\n");
|
||||
|
||||
|
||||
// good buffer, add this to the mix
|
||||
|
||||
if (_isStarved) {
|
||||
|
||||
// if this buffer has just finished replenishing after being starved, the number of frames in it now
|
||||
// minus one (since a frame will be read immediately after this) is the length of the jitter buffer
|
||||
_currentJitterBufferFrames = samplesAvailable() / samplesPerFrame - 1;
|
||||
printf("jitter buffer length is now %d; desired: %d --------\n", _currentJitterBufferFrames, _desiredJitterBufferFrames);
|
||||
|
||||
_isStarved = false;
|
||||
}
|
||||
|
||||
|
@ -261,7 +239,5 @@ void PositionalAudioRingBuffer::updateDesiredJitterBufferFrames() {
|
|||
if (_desiredJitterBufferFrames < 1) {
|
||||
_desiredJitterBufferFrames = 1;
|
||||
}
|
||||
|
||||
printf(" desired jbuffer size is now %d --------------------------------\n", _desiredJitterBufferFrames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ private:
|
|||
bool _newWindowMaxGapAvailable;
|
||||
};
|
||||
|
||||
|
||||
class PositionalAudioRingBuffer : public AudioRingBuffer {
|
||||
public:
|
||||
enum Type {
|
||||
|
@ -99,8 +98,6 @@ protected:
|
|||
InterframeTimeGapHistory _interframeTimeGapHistory;
|
||||
int _desiredJitterBufferFrames;
|
||||
int _currentJitterBufferFrames;
|
||||
|
||||
quint64 _lastMixTime;
|
||||
};
|
||||
|
||||
#endif // hifi_PositionalAudioRingBuffer_h
|
||||
|
|
Loading…
Reference in a new issue