mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-27 00:03:37 +01:00
Audio: Protect against time skew.
It might be possible a clock is adjusting backwards slightly after a time update, and this could've caused sz to become negative. Based on crash reports.
This commit is contained in:
1 parent
01b99eff98
commit
b77695c760
1 file changed
+4
-1
@@ -344,7 +344,10 @@ int BackgroundAudio::Play() {
|
||||
}
|
||||
|
||||
double now = time_now_d();
|
||||
int sz = lastPlaybackTime_ <= 0.0 ? 44100 / 60 : (int)((now - lastPlaybackTime_) * 44100);
|
||||
int sz = 44100 / 60;
|
||||
if (lastPlaybackTime_ > 0.0 && lastPlaybackTime_ >= now) {
|
||||
sz = (int)((now - lastPlaybackTime_) * 44100);
|
||||
}
|
||||
sz = std::min(BUFSIZE / 2, sz);
|
||||
if (at3Reader_) {
|
||||
if (at3Reader_->Read(buffer, sz)) {
|
||||
|
||||
Reference in new issue
Block a user