output/Thread: move code to InternalClose()
This commit is contained in:
parent
89a2e5ded3
commit
b4cce80727
@ -422,6 +422,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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs inside the OutputThread.
|
* Runs inside the OutputThread.
|
||||||
*/
|
*/
|
||||||
|
@ -172,16 +172,22 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
AudioOutputControl::InternalCheckClose(bool drain) noexcept
|
AudioOutputControl::InternalClose(bool drain) noexcept
|
||||||
{
|
{
|
||||||
if (!IsOpen())
|
assert(IsOpen());
|
||||||
return;
|
|
||||||
|
|
||||||
open = false;
|
open = false;
|
||||||
output->Close(drain);
|
output->Close(drain);
|
||||||
source.Close();
|
source.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
AudioOutputControl::InternalCheckClose(bool drain) noexcept
|
||||||
|
{
|
||||||
|
if (IsOpen())
|
||||||
|
InternalClose(drain);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until the output's delay reaches zero.
|
* Wait until the output's delay reaches zero.
|
||||||
*
|
*
|
||||||
@ -211,7 +217,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);
|
||||||
|
|
||||||
InternalCheckClose(false);
|
InternalClose(false);
|
||||||
|
|
||||||
/* don't automatically reopen this device for 10
|
/* don't automatically reopen this device for 10
|
||||||
seconds */
|
seconds */
|
||||||
@ -259,7 +265,7 @@ AudioOutputControl::PlayChunk() noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nbytes == 0) {
|
if (nbytes == 0) {
|
||||||
InternalCheckClose(false);
|
InternalClose(false);
|
||||||
|
|
||||||
/* don't automatically reopen this device for
|
/* don't automatically reopen this device for
|
||||||
10 seconds */
|
10 seconds */
|
||||||
@ -330,9 +336,7 @@ AudioOutputControl::InternalPause() noexcept
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (!output->IteratePause()) {
|
if (!output->IteratePause()) {
|
||||||
open = false;
|
InternalClose(false);
|
||||||
output->Close(false);
|
|
||||||
source.Close();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (command == Command::NONE);
|
} while (command == Command::NONE);
|
||||||
|
Loading…
Reference in New Issue
Block a user