Commit 59181ac5 authored by Max Kellermann's avatar Max Kellermann

output/Thread: move code to BeginPause(), IteratePause()

parent 2a831fa5
...@@ -516,6 +516,9 @@ private: ...@@ -516,6 +516,9 @@ private:
*/ */
bool Play(); bool Play();
void BeginPause();
bool IteratePause();
void Pause(); void Pause();
/** /**
......
...@@ -365,7 +365,7 @@ AudioOutput::Play() ...@@ -365,7 +365,7 @@ AudioOutput::Play()
} }
inline void inline void
AudioOutput::Pause() AudioOutput::BeginPause()
{ {
{ {
const ScopeUnlock unlock(mutex); const ScopeUnlock unlock(mutex);
...@@ -373,13 +373,13 @@ AudioOutput::Pause() ...@@ -373,13 +373,13 @@ AudioOutput::Pause()
} }
pause = true; pause = true;
CommandFinished(); }
do {
if (!WaitForDelay())
break;
inline bool
AudioOutput::IteratePause()
{
bool success; bool success;
try { try {
const ScopeUnlock unlock(mutex); const ScopeUnlock unlock(mutex);
success = ao_plugin_pause(*this); success = ao_plugin_pause(*this);
...@@ -389,10 +389,24 @@ AudioOutput::Pause() ...@@ -389,10 +389,24 @@ AudioOutput::Pause()
success = false; success = false;
} }
if (!success) { if (!success)
Close(false); Close(false);
return success;
}
inline void
AudioOutput::Pause()
{
BeginPause();
CommandFinished();
do {
if (!WaitForDelay())
break;
if (!IteratePause())
break; break;
}
} while (command == Command::NONE); } while (command == Command::NONE);
pause = false; pause = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment