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,
|
||||
const MusicPipe &pipe) noexcept;
|
||||
|
||||
/**
|
||||
* Runs inside the OutputThread.
|
||||
*/
|
||||
void InternalClose(bool drain) noexcept;
|
||||
|
||||
/**
|
||||
* Wait until the output's delay reaches zero.
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user