mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:57:00 +02:00
Fix rounding error in allOrNothing mode
This commit is contained in:
parent
0d0a9fbd09
commit
ba3282e12b
1 changed files with 10 additions and 2 deletions
|
@ -364,9 +364,17 @@ int InboundAudioStream::popSamples(int maxSamples, bool allOrNothing) {
|
||||||
// buffer calculations.
|
// buffer calculations.
|
||||||
setToStarved();
|
setToStarved();
|
||||||
_consecutiveNotMixedCount++;
|
_consecutiveNotMixedCount++;
|
||||||
//Kick PLC to generate a filler frame, reducing 'click'
|
|
||||||
lostAudioData(allOrNothing ? (maxSamples - samplesAvailable) / _ringBuffer.getNumFrameSamples() : 1);
|
// use PLC to generate extrapolated audio data, to reduce clicking
|
||||||
|
if (allOrNothing) {
|
||||||
|
int samplesNeeded = maxSamples - samplesAvailable;
|
||||||
|
int packetsNeeded = (samplesNeeded + _ringBuffer.getNumFrameSamples() - 1) / _ringBuffer.getNumFrameSamples();
|
||||||
|
lostAudioData(packetsNeeded);
|
||||||
|
} else {
|
||||||
|
lostAudioData(1);
|
||||||
|
}
|
||||||
samplesAvailable = _ringBuffer.samplesAvailable();
|
samplesAvailable = _ringBuffer.samplesAvailable();
|
||||||
|
|
||||||
if (samplesAvailable > 0) {
|
if (samplesAvailable > 0) {
|
||||||
samplesPopped = std::min(samplesAvailable, maxSamples);
|
samplesPopped = std::min(samplesAvailable, maxSamples);
|
||||||
popSamplesNoCheck(samplesPopped);
|
popSamplesNoCheck(samplesPopped);
|
||||||
|
|
Loading…
Reference in a new issue