Merge pull request #15009 from unknownbrackets/audio-cleanup

Audio: Correct protection against time skew
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2021-10-11 06:38:58 +02:00
commit bb64c176fc
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -283,7 +283,7 @@ void StereoResampler::PushSamples(const s32 *samples, unsigned int numSamples) {
}
// Check if we need to roll over to the start of the buffer during the copy.
int indexW_left_samples = m_maxBufsize * 2 - (indexW & INDEX_MASK);
unsigned int indexW_left_samples = m_maxBufsize * 2 - (indexW & INDEX_MASK);
if (numSamples * 2 > indexW_left_samples) {
ClampBufferToS16WithVolume(&m_buffer[indexW & INDEX_MASK], samples, indexW_left_samples);
ClampBufferToS16WithVolume(&m_buffer[0], samples + indexW_left_samples, numSamples * 2 - indexW_left_samples);
+1 -1
View File
@@ -345,7 +345,7 @@ int BackgroundAudio::Play() {
double now = time_now_d();
int sz = 44100 / 60;
if (lastPlaybackTime_ > 0.0 && lastPlaybackTime_ >= now) {
if (lastPlaybackTime_ > 0.0 && lastPlaybackTime_ <= now) {
sz = (int)((now - lastPlaybackTime_) * 44100);
}
sz = std::min(BUFSIZE / 2, sz);