output/Thread: move code to InternalCloseOutput()
This commit is contained in:
@@ -429,6 +429,12 @@ private:
|
|||||||
void InternalOpen(AudioFormat audio_format,
|
void InternalOpen(AudioFormat audio_format,
|
||||||
const MusicPipe &pipe) noexcept;
|
const MusicPipe &pipe) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs inside the OutputThread.
|
||||||
|
* Caller must lock the mutex.
|
||||||
|
*/
|
||||||
|
void InternalCloseOutput(bool drain) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs inside the OutputThread.
|
* Runs inside the OutputThread.
|
||||||
* Caller must lock the mutex.
|
* Caller must lock the mutex.
|
||||||
|
@@ -60,14 +60,10 @@ AudioOutputControl::InternalOpen2(const AudioFormat in_audio_format)
|
|||||||
|
|
||||||
const auto cf = in_audio_format.WithMask(output->config_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
|
/* if the filter's output format changes, the output
|
||||||
must be reopened as well */
|
must be reopened as well */
|
||||||
open = false;
|
InternalCloseOutput(true);
|
||||||
|
|
||||||
const ScopeUnlock unlock(mutex);
|
|
||||||
output->CloseOutput(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
output->filter_audio_format = cf;
|
output->filter_audio_format = cf;
|
||||||
|
|
||||||
@@ -175,6 +171,17 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
|
|||||||
ToString(output->out_audio_format).c_str());
|
ToString(output->out_audio_format).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
AudioOutputControl::InternalCloseOutput(bool drain) noexcept
|
||||||
|
{
|
||||||
|
assert(IsOpen());
|
||||||
|
|
||||||
|
open = false;
|
||||||
|
|
||||||
|
const ScopeUnlock unlock(mutex);
|
||||||
|
output->CloseOutput(drain);
|
||||||
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
AudioOutputControl::InternalClose(bool drain) noexcept
|
AudioOutputControl::InternalClose(bool drain) noexcept
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user