mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-11-22 23:43:47 +00:00
audio_core: ignore renderer wait when stream is paused
This commit is contained in:
parent
767c4b5a99
commit
ecaa038b4d
4 changed files with 18 additions and 4 deletions
|
@ -146,7 +146,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
paused = true;
|
||||
SignalPause();
|
||||
if (cubeb_stream_stop(stream_backend) != CUBEB_OK) {
|
||||
LOG_CRITICAL(Audio_Sink, "Error stopping cubeb stream");
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
if (device == 0 || paused) {
|
||||
return;
|
||||
}
|
||||
paused = true;
|
||||
SignalPause();
|
||||
SDL_PauseAudioDevice(device, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -282,11 +282,19 @@ u64 SinkStream::GetExpectedPlayedSampleCount() {
|
|||
void SinkStream::WaitFreeSpace(std::stop_token stop_token) {
|
||||
std::unique_lock lk{release_mutex};
|
||||
release_cv.wait_for(lk, std::chrono::milliseconds(5),
|
||||
[this]() { return queued_buffers < max_queue_size; });
|
||||
[this]() { return paused || queued_buffers < max_queue_size; });
|
||||
if (queued_buffers > max_queue_size + 3) {
|
||||
Common::CondvarWait(release_cv, lk, stop_token,
|
||||
[this] { return queued_buffers < max_queue_size; });
|
||||
[this] { return paused || queued_buffers < max_queue_size; });
|
||||
}
|
||||
}
|
||||
|
||||
void SinkStream::SignalPause() {
|
||||
{
|
||||
std::scoped_lock lk{release_mutex};
|
||||
paused = true;
|
||||
}
|
||||
release_cv.notify_one();
|
||||
}
|
||||
|
||||
} // namespace AudioCore::Sink
|
||||
|
|
|
@ -213,6 +213,12 @@ public:
|
|||
*/
|
||||
void WaitFreeSpace(std::stop_token stop_token);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Unblocks the ADSP if the stream is paused.
|
||||
*/
|
||||
void SignalPause();
|
||||
|
||||
protected:
|
||||
/// Core system
|
||||
Core::System& system;
|
||||
|
|
Loading…
Reference in a new issue