Android: Empty audio buffers when returning from activity

This commit is contained in:
Connor McLaughlin 2020-11-07 22:03:09 +10:00
parent f68ad7d0c3
commit 8cb89636eb
2 changed files with 5 additions and 2 deletions

View file

@ -473,9 +473,9 @@ void AndroidHostInterface::SurfaceChanged(ANativeWindow* surface, int format, in
m_display->ChangeRenderWindow(wi); m_display->ChangeRenderWindow(wi);
if (surface && System::GetState() == System::State::Paused) if (surface && System::GetState() == System::State::Paused)
System::SetState(System::State::Running); PauseSystem(false);
else if (!surface && System::IsRunning()) else if (!surface && System::IsRunning())
System::SetState(System::State::Paused); PauseSystem(true);
} }
} }

View file

@ -164,7 +164,10 @@ void CommonHostInterface::PauseSystem(bool paused)
return; return;
System::SetState(paused ? System::State::Paused : System::State::Running); System::SetState(paused ? System::State::Paused : System::State::Running);
if (!paused)
m_audio_stream->EmptyBuffers();
m_audio_stream->PauseOutput(paused); m_audio_stream->PauseOutput(paused);
OnSystemPaused(paused); OnSystemPaused(paused);
UpdateSpeedLimiterState(); UpdateSpeedLimiterState();