mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +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.
|
||||
setToStarved();
|
||||
_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();
|
||||
|
||||
if (samplesAvailable > 0) {
|
||||
samplesPopped = std::min(samplesAvailable, maxSamples);
|
||||
popSamplesNoCheck(samplesPopped);
|
||||
|
|
Loading…
Reference in a new issue