diff options
author | Max Kellermann <max@musicpd.org> | 2018-11-12 11:30:05 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-11-12 12:09:37 +0100 |
commit | e097fef79e66b6ff6cf04a911067d3750b20bd48 (patch) | |
tree | e40e3df98debf38d8399fd00d4b3fac745765e82 /src/output/Control.cxx | |
parent | 9a813cd3b11057d767e5bc30b83350e6052d1c28 (diff) |
output/control: add command `RELEASE`
With the new command, the decision to pause or close the output moves
into the output thread.
Diffstat (limited to 'src/output/Control.cxx')
-rw-r--r-- | src/output/Control.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/output/Control.cxx b/src/output/Control.cxx index 81847a1de..39812b165 100644 --- a/src/output/Control.cxx +++ b/src/output/Control.cxx @@ -347,10 +347,22 @@ AudioOutputControl::LockAllowPlay() noexcept void AudioOutputControl::LockRelease() noexcept { - if (always_on) - LockPauseAsync(); + if (output->mixer != nullptr && + (!always_on || !output->SupportsPause())) + /* the device has no pause mode: close the mixer, + unless its "global" flag is set (checked by + mixer_auto_close()) */ + mixer_auto_close(output->mixer); + + const std::lock_guard<Mutex> protect(mutex); + + assert(!open || !fail_timer.IsDefined()); + assert(allow_play); + + if (IsOpen()) + CommandWait(Command::RELEASE); else - LockCloseWait(); + fail_timer.Reset(); } void |