Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e097fef7
Commit
e097fef7
authored
Nov 12, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/control: add command `RELEASE`
With the new command, the decision to pause or close the output moves into the output thread.
parent
9a813cd3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
3 deletions
+45
-3
Control.cxx
src/output/Control.cxx
+15
-3
Control.hxx
src/output/Control.hxx
+6
-0
Thread.cxx
src/output/Thread.cxx
+24
-0
No files found.
src/output/Control.cxx
View file @
e097fef7
...
...
@@ -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
LockCloseWai
t
();
fail_timer
.
Rese
t
();
}
void
...
...
src/output/Control.hxx
View file @
e097fef7
...
...
@@ -132,6 +132,12 @@ class AudioOutputControl {
PAUSE
,
/**
* Close or pause the device, depending on the
* #always_on setting.
*/
RELEASE
,
/**
* Drains the internal (hardware) buffers of the device. This
* operation may take a while to complete.
*/
...
...
src/output/Thread.cxx
View file @
e097fef7
...
...
@@ -456,6 +456,30 @@ AudioOutputControl::Task() noexcept
the new command first */
continue
;
case
Command
:
:
RELEASE
:
if
(
!
open
)
{
/* the output has failed after
the PAUSE command was submitted; bail
out */
CommandFinished
();
break
;
}
if
(
always_on
)
{
/* in "always_on" mode, the output is
paused instead of being closed */
InternalPause
();
}
else
{
InternalClose
(
false
);
CommandFinished
();
}
/* don't "break" here: this might cause
Play() to be called when command==CLOSE
ends the paused state - "continue" checks
the new command first */
continue
;
case
Command
:
:
DRAIN
:
if
(
open
)
InternalDrain
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment