Commit 7cb82fe8 authored by Max Kellermann's avatar Max Kellermann

output/Thread: move code to InternalClose()

parent 0494779e
......@@ -385,6 +385,11 @@ private:
const MusicPipe &pipe) noexcept;
/**
* Runs inside the OutputThread.
*/
void InternalClose(bool drain) noexcept;
/**
* Wait until the output's delay reaches zero.
*
* @return true if playback should be continued, false if a
......
......@@ -215,8 +215,7 @@ AudioOutputControl::InternalDisable() noexcept
if (!really_enabled)
return;
if (output->open)
output->Close(false);
InternalClose(false);
really_enabled = false;
output->Disable();
......@@ -243,6 +242,15 @@ AudioOutputControl::InternalOpen(const AudioFormat audio_format,
}
}
inline void
AudioOutputControl::InternalClose(bool drain) noexcept
{
if (!IsOpen())
return;
output->Close(drain);
}
void
AudioOutput::Close(bool drain) noexcept
{
......@@ -299,7 +307,7 @@ try {
FormatError(e, "Failed to filter for output \"%s\" [%s]",
GetName(), output->plugin.name);
output->Close(false);
InternalClose(false);
/* don't automatically reopen this device for 10
seconds */
......@@ -347,7 +355,7 @@ AudioOutputControl::PlayChunk() noexcept
}
if (nbytes == 0) {
output->Close(false);
InternalClose(false);
/* don't automatically reopen this device for
10 seconds */
......@@ -491,8 +499,7 @@ AudioOutputControl::Task()
break;
case Command::CLOSE:
if (IsOpen())
output->Close(false);
InternalClose(false);
CommandFinished();
break;
......
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