mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 17:54:15 +02:00
changed InterframeTimeGapHistory to InterframeTimeGapStats
This commit is contained in:
parent
e5d7d471e3
commit
ffc20b8876
4 changed files with 10 additions and 10 deletions
|
@ -19,7 +19,7 @@ AvatarAudioRingBuffer::AvatarAudioRingBuffer(bool isStereo) :
|
||||||
}
|
}
|
||||||
|
|
||||||
int AvatarAudioRingBuffer::parseData(const QByteArray& packet) {
|
int AvatarAudioRingBuffer::parseData(const QByteArray& packet) {
|
||||||
_interframeTimeGapHistory.frameReceived();
|
_interframeTimeGapStats.frameReceived();
|
||||||
updateDesiredJitterBufferFrames();
|
updateDesiredJitterBufferFrames();
|
||||||
|
|
||||||
_shouldLoopbackForNode = (packetTypeForPacket(packet) == PacketTypeMicrophoneAudioWithEcho);
|
_shouldLoopbackForNode = (packetTypeForPacket(packet) == PacketTypeMicrophoneAudioWithEcho);
|
||||||
|
|
|
@ -31,7 +31,7 @@ InjectedAudioRingBuffer::InjectedAudioRingBuffer(const QUuid& streamIdentifier)
|
||||||
const uchar MAX_INJECTOR_VOLUME = 255;
|
const uchar MAX_INJECTOR_VOLUME = 255;
|
||||||
|
|
||||||
int InjectedAudioRingBuffer::parseData(const QByteArray& packet) {
|
int InjectedAudioRingBuffer::parseData(const QByteArray& packet) {
|
||||||
_interframeTimeGapHistory.frameReceived();
|
_interframeTimeGapStats.frameReceived();
|
||||||
updateDesiredJitterBufferFrames();
|
updateDesiredJitterBufferFrames();
|
||||||
|
|
||||||
// setup a data stream to read from this packet
|
// setup a data stream to read from this packet
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "PositionalAudioRingBuffer.h"
|
#include "PositionalAudioRingBuffer.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
|
|
||||||
InterframeTimeGapHistory::InterframeTimeGapHistory()
|
InterframeTimeGapStats::InterframeTimeGapStats()
|
||||||
: _lastFrameReceivedTime(0),
|
: _lastFrameReceivedTime(0),
|
||||||
_numSamplesInCurrentInterval(0),
|
_numSamplesInCurrentInterval(0),
|
||||||
_currentIntervalMaxGap(0),
|
_currentIntervalMaxGap(0),
|
||||||
|
@ -32,7 +32,7 @@ InterframeTimeGapHistory::InterframeTimeGapHistory()
|
||||||
memset(_intervalMaxGaps, 0, TIME_GAP_NUM_INTERVALS_IN_WINDOW*sizeof(quint64));
|
memset(_intervalMaxGaps, 0, TIME_GAP_NUM_INTERVALS_IN_WINDOW*sizeof(quint64));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterframeTimeGapHistory::frameReceived() {
|
void InterframeTimeGapStats::frameReceived() {
|
||||||
quint64 now = usecTimestampNow();
|
quint64 now = usecTimestampNow();
|
||||||
|
|
||||||
// make sure this isn't the first time frameReceived() is called so can actually calculate a gap.
|
// make sure this isn't the first time frameReceived() is called so can actually calculate a gap.
|
||||||
|
@ -79,7 +79,7 @@ void InterframeTimeGapHistory::frameReceived() {
|
||||||
_lastFrameReceivedTime = now;
|
_lastFrameReceivedTime = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 InterframeTimeGapHistory::getWindowMaxGap() {
|
quint64 InterframeTimeGapStats::getWindowMaxGap() {
|
||||||
_newWindowMaxGapAvailable = false;
|
_newWindowMaxGapAvailable = false;
|
||||||
return _windowMaxGap;
|
return _windowMaxGap;
|
||||||
}
|
}
|
||||||
|
@ -234,8 +234,8 @@ void PositionalAudioRingBuffer::updateDesiredJitterBufferFrames() {
|
||||||
|
|
||||||
const float USECS_PER_FRAME = NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL * USECS_PER_SECOND / (float)SAMPLE_RATE;
|
const float USECS_PER_FRAME = NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL * USECS_PER_SECOND / (float)SAMPLE_RATE;
|
||||||
|
|
||||||
if (_interframeTimeGapHistory.hasNewWindowMaxGapAvailable()) {
|
if (_interframeTimeGapStats.hasNewWindowMaxGapAvailable()) {
|
||||||
_desiredJitterBufferFrames = ceilf((float)_interframeTimeGapHistory.getWindowMaxGap() / USECS_PER_FRAME);
|
_desiredJitterBufferFrames = ceilf((float)_interframeTimeGapStats.getWindowMaxGap() / USECS_PER_FRAME);
|
||||||
if (_desiredJitterBufferFrames < 1) {
|
if (_desiredJitterBufferFrames < 1) {
|
||||||
_desiredJitterBufferFrames = 1;
|
_desiredJitterBufferFrames = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ const int TIME_GAP_NUM_SAMPLES_IN_INTERVAL = 500;
|
||||||
const int TIME_GAP_NUM_INTERVALS_IN_WINDOW = 10;
|
const int TIME_GAP_NUM_INTERVALS_IN_WINDOW = 10;
|
||||||
|
|
||||||
// class used to track time between incoming frames for the purpose of varying the jitter buffer length
|
// class used to track time between incoming frames for the purpose of varying the jitter buffer length
|
||||||
class InterframeTimeGapHistory {
|
class InterframeTimeGapStats {
|
||||||
public:
|
public:
|
||||||
InterframeTimeGapHistory();
|
InterframeTimeGapStats();
|
||||||
|
|
||||||
void frameReceived();
|
void frameReceived();
|
||||||
bool hasNewWindowMaxGapAvailable() const { return _newWindowMaxGapAvailable; }
|
bool hasNewWindowMaxGapAvailable() const { return _newWindowMaxGapAvailable; }
|
||||||
|
@ -95,7 +95,7 @@ protected:
|
||||||
float _nextOutputTrailingLoudness;
|
float _nextOutputTrailingLoudness;
|
||||||
AABox* _listenerUnattenuatedZone;
|
AABox* _listenerUnattenuatedZone;
|
||||||
|
|
||||||
InterframeTimeGapHistory _interframeTimeGapHistory;
|
InterframeTimeGapStats _interframeTimeGapStats;
|
||||||
int _desiredJitterBufferFrames;
|
int _desiredJitterBufferFrames;
|
||||||
int _currentJitterBufferFrames;
|
int _currentJitterBufferFrames;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue