diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/output/Internal.hxx | 7 | ||||
-rw-r--r-- | src/output/OutputThread.cxx | 18 |
2 files changed, 19 insertions, 6 deletions
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() { |