output/Thread: move code to InternalClose()
This commit is contained in:
parent
0494779ecb
commit
7cb82fe8f3
@ -384,6 +384,11 @@ private:
|
|||||||
void InternalOpen(AudioFormat audio_format,
|
void InternalOpen(AudioFormat audio_format,
|
||||||
const MusicPipe &pipe) noexcept;
|
const MusicPipe &pipe) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs inside the OutputThread.
|
||||||
|
*/
|
||||||
|
void InternalClose(bool drain) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until the output's delay reaches zero.
|
* Wait until the output's delay reaches zero.
|
||||||
*
|
*
|
||||||
|
@ -215,8 +215,7 @@ AudioOutputControl::InternalDisable() noexcept
|
|||||||
if (!really_enabled)
|
if (!really_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (output->open)
|
InternalClose(false);
|
||||||
output->Close(false);
|
|
||||||
|
|
||||||
really_enabled = false;
|
really_enabled = false;
|
||||||
output->Disable();
|
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
|
void
|
||||||
AudioOutput::Close(bool drain) noexcept
|
AudioOutput::Close(bool drain) noexcept
|
||||||
{
|
{
|
||||||
@ -299,7 +307,7 @@ try {
|
|||||||
FormatError(e, "Failed to filter for output \"%s\" [%s]",
|
FormatError(e, "Failed to filter for output \"%s\" [%s]",
|
||||||
GetName(), output->plugin.name);
|
GetName(), output->plugin.name);
|
||||||
|
|
||||||
output->Close(false);
|
InternalClose(false);
|
||||||
|
|
||||||
/* don't automatically reopen this device for 10
|
/* don't automatically reopen this device for 10
|
||||||
seconds */
|
seconds */
|
||||||
@ -347,7 +355,7 @@ AudioOutputControl::PlayChunk() noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nbytes == 0) {
|
if (nbytes == 0) {
|
||||||
output->Close(false);
|
InternalClose(false);
|
||||||
|
|
||||||
/* don't automatically reopen this device for
|
/* don't automatically reopen this device for
|
||||||
10 seconds */
|
10 seconds */
|
||||||
@ -491,8 +499,7 @@ AudioOutputControl::Task()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::CLOSE:
|
case Command::CLOSE:
|
||||||
if (IsOpen())
|
InternalClose(false);
|
||||||
output->Close(false);
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user