From bef8c83388b71430100349faa20081bd77f155c6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 23 Oct 2014 23:24:01 +0200 Subject: OutputThread: move code to CloseOutput() --- src/output/Internal.hxx | 7 +++++++ src/output/OutputThread.cxx | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index 23b027c54..6b67a8783 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -382,6 +382,13 @@ private: void Close(bool drain); void Reopen(); + /** + * Close the output plugin. + * + * Mutex must not be locked. + */ + void CloseOutput(bool drain); + AudioFormat OpenFilter(AudioFormat &format, Error &error_r); /** diff --git a/src/output/OutputThread.cxx b/src/output/OutputThread.cxx index 9baaaf0e0..badf8f6c9 100644 --- a/src/output/OutputThread.cxx +++ b/src/output/OutputThread.cxx @@ -251,12 +251,7 @@ AudioOutput::Close(bool drain) mutex.unlock(); - if (drain) - ao_plugin_drain(this); - else - ao_plugin_cancel(this); - - ao_plugin_close(this); + CloseOutput(drain); CloseFilter(); mutex.lock(); @@ -265,6 +260,17 @@ AudioOutput::Close(bool drain) plugin.name, name); } +inline void +AudioOutput::CloseOutput(bool drain) +{ + if (drain) + ao_plugin_drain(this); + else + ao_plugin_cancel(this); + + ao_plugin_close(this); +} + void AudioOutput::ReopenFilter() { -- cgit v1.2.3