mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
Merge remote-tracking branch 'origin'
This commit is contained in:
commit
7598917c2a
2 changed files with 5 additions and 4 deletions
|
@ -24,7 +24,7 @@ const short PACKET_LENGTH_SAMPLES = PACKET_LENGTH_BYTES / sizeof(int16_t);
|
||||||
const int PHASE_DELAY_AT_90 = 20;
|
const int PHASE_DELAY_AT_90 = 20;
|
||||||
const float AMPLITUDE_RATIO_AT_90 = 0.5;
|
const float AMPLITUDE_RATIO_AT_90 = 0.5;
|
||||||
|
|
||||||
const short RING_BUFFER_FRAMES = 4;
|
const short RING_BUFFER_FRAMES = 5;
|
||||||
const short RING_BUFFER_SIZE_SAMPLES = RING_BUFFER_FRAMES * BUFFER_LENGTH_SAMPLES;
|
const short RING_BUFFER_SIZE_SAMPLES = RING_BUFFER_FRAMES * BUFFER_LENGTH_SAMPLES;
|
||||||
|
|
||||||
const short JITTER_BUFFER_LENGTH_MSECS = 1;
|
const short JITTER_BUFFER_LENGTH_MSECS = 1;
|
||||||
|
@ -239,6 +239,7 @@ void *receiveAudioViaUDP(void *args) {
|
||||||
|
|
||||||
// check for possibility of overlap
|
// check for possibility of overlap
|
||||||
bufferSampleOverlap = ringBuffer->bufferOverlap(copyToPointer, PACKET_LENGTH_SAMPLES);
|
bufferSampleOverlap = ringBuffer->bufferOverlap(copyToPointer, PACKET_LENGTH_SAMPLES);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bufferSampleOverlap) {
|
if (!bufferSampleOverlap) {
|
||||||
|
@ -262,7 +263,7 @@ void *receiveAudioViaUDP(void *args) {
|
||||||
// no jitter buffer, but overlap
|
// no jitter buffer, but overlap
|
||||||
// copy to the end, and then from the begining to the overlap
|
// copy to the end, and then from the begining to the overlap
|
||||||
memcpy(copyToPointer, receivedData, (PACKET_LENGTH_SAMPLES - bufferSampleOverlap) * sizeof(int16_t));
|
memcpy(copyToPointer, receivedData, (PACKET_LENGTH_SAMPLES - bufferSampleOverlap) * sizeof(int16_t));
|
||||||
memcpy(ringBuffer->buffer, receivedData + bufferSampleOverlap, bufferSampleOverlap * sizeof(int16_t));
|
memcpy(ringBuffer->buffer, receivedData + (PACKET_LENGTH_SAMPLES - bufferSampleOverlap), bufferSampleOverlap * sizeof(int16_t));
|
||||||
|
|
||||||
// the end of the write is the amount of overlap
|
// the end of the write is the amount of overlap
|
||||||
ringBuffer->endOfLastWrite = ringBuffer->buffer + bufferSampleOverlap;
|
ringBuffer->endOfLastWrite = ringBuffer->buffer + bufferSampleOverlap;
|
||||||
|
|
|
@ -36,7 +36,7 @@ short AudioRingBuffer::bufferOverlap(int16_t *pointer, short addedDistance)
|
||||||
{
|
{
|
||||||
short samplesLeft = (buffer + ringBufferLengthSamples) - pointer;
|
short samplesLeft = (buffer + ringBufferLengthSamples) - pointer;
|
||||||
|
|
||||||
if (samplesLeft <= addedDistance) {
|
if (samplesLeft < addedDistance) {
|
||||||
return addedDistance - samplesLeft;
|
return addedDistance - samplesLeft;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue