mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04: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:
parent
01b99eff98
commit
b77695c760
1 changed files with 4 additions and 1 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue