From fb907f5f7613e83c0db2061cc73c9b2918704872 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 14 Dec 2016 08:29:09 +0100 Subject: [PATCH] output/Thread: KILL implicitly closes and disables the AudioOutput Reduce shutdown latency by two commands per output. --- src/output/MultipleOutputs.cxx | 8 +------- src/output/OutputControl.cxx | 5 ++--- src/output/OutputThread.cxx | 1 + 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index 7b7a99146..d5b6340d0 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -43,14 +43,8 @@ MultipleOutputs::MultipleOutputs(MixerListener &_mixer_listener) MultipleOutputs::~MultipleOutputs() { - for (auto i : outputs) { - { - const ScopeLock lock(i->mutex); - i->DisableWait(); - } - + for (auto i : outputs) i->Finish(); - } } static AudioOutput * diff --git a/src/output/OutputControl.cxx b/src/output/OutputControl.cxx index 17ba3da53..e7221a171 100644 --- a/src/output/OutputControl.cxx +++ b/src/output/OutputControl.cxx @@ -276,9 +276,8 @@ AudioOutput::StopThread() void AudioOutput::Finish() { - LockCloseWait(); - - assert(!fail_timer.IsDefined()); + if (mixer != nullptr) + mixer_auto_close(mixer); if (thread.IsDefined()) StopThread(); diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 799626f33..2318f43b3 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -642,6 +642,7 @@ AudioOutput::Task() continue; case Command::KILL: + Disable(); pipe.Cancel(); CommandFinished(); return;