mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-30 12:20:58 +01:00
Merge pull request #12019 from liamwhite/more-shutdown-deadlocks
audio_core: ignore renderer wait when stream is paused
This commit is contained in:
commit
51fc608f68
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