Commit 3197c0fd authored by Max Kellermann's avatar Max Kellermann

output/Thread: move code to InternalCloseOutput()

parent 4580c685
......@@ -433,6 +433,12 @@ private:
* Runs inside the OutputThread.
* Caller must lock the mutex.
*/
void InternalCloseOutput(bool drain) noexcept;
/**
* Runs inside the OutputThread.
* Caller must lock the mutex.
*/
void InternalClose(bool drain) noexcept;
/**
......
......@@ -60,14 +60,10 @@ AudioOutputControl::InternalOpen2(const AudioFormat in_audio_format)
const auto cf = in_audio_format.WithMask(output->config_audio_format);
if (open && cf != output->filter_audio_format) {
if (open && cf != output->filter_audio_format)
/* if the filter's output format changes, the output
must be reopened as well */
open = false;
const ScopeUnlock unlock(mutex);
output->CloseOutput(true);
}
InternalCloseOutput(true);
output->filter_audio_format = cf;
......@@ -176,6 +172,17 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
}
inline void
AudioOutputControl::InternalCloseOutput(bool drain) noexcept
{
assert(IsOpen());
open = false;
const ScopeUnlock unlock(mutex);
output->CloseOutput(drain);
}
inline void
AudioOutputControl::InternalClose(bool drain) noexcept
{
assert(IsOpen());
......
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