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
db95aa25
Commit
db95aa25
authored
Dec 29, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Control: pass "force" flag to LockUpdate()
Reduce overhead by eliminating MultipleOutputs::ResetReopen().
parent
982d1bf6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
32 deletions
+12
-32
Internal.hxx
src/output/Internal.hxx
+3
-1
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+5
-21
MultipleOutputs.hxx
src/output/MultipleOutputs.hxx
+1
-8
OutputControl.cxx
src/output/OutputControl.cxx
+3
-2
No files found.
src/output/Internal.hxx
View file @
db95aa25
...
...
@@ -383,10 +383,12 @@ public:
* Opens or closes the device, depending on the "enabled"
* flag.
*
* @param force true to ignore the #fail_timer
* @return true if the device is open
*/
bool
LockUpdate
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
mp
);
const
MusicPipe
&
mp
,
bool
force
);
void
LockPlay
();
...
...
src/output/MultipleOutputs.cxx
View file @
db95aa25
...
...
@@ -145,23 +145,8 @@ MultipleOutputs::AllowPlay()
ao
->
LockAllowPlay
();
}
static
void
audio_output_reset_reopen
(
AudioOutput
*
ao
)
{
const
ScopeLock
protect
(
ao
->
mutex
);
ao
->
fail_timer
.
Reset
();
}
void
MultipleOutputs
::
ResetReopen
()
{
for
(
auto
ao
:
outputs
)
audio_output_reset_reopen
(
ao
);
}
bool
MultipleOutputs
::
Update
()
MultipleOutputs
::
Update
(
bool
force
)
{
bool
ret
=
false
;
...
...
@@ -169,7 +154,7 @@ MultipleOutputs::Update()
return
false
;
for
(
auto
ao
:
outputs
)
ret
=
ao
->
LockUpdate
(
input_audio_format
,
*
pipe
)
ret
=
ao
->
LockUpdate
(
input_audio_format
,
*
pipe
,
force
)
||
ret
;
return
ret
;
...
...
@@ -190,7 +175,7 @@ MultipleOutputs::Play(MusicChunk *chunk)
assert
(
chunk
!=
nullptr
);
assert
(
chunk
->
CheckFormat
(
input_audio_format
));
if
(
!
Update
())
if
(
!
Update
(
false
))
/* TODO: obtain real error */
throw
std
::
runtime_error
(
"Failed to open audio output"
);
...
...
@@ -224,9 +209,8 @@ MultipleOutputs::Open(const AudioFormat audio_format,
input_audio_format
=
audio_format
;
ResetReopen
();
EnableDisable
();
Update
();
Update
(
true
);
std
::
exception_ptr
first_error
;
...
...
@@ -341,7 +325,7 @@ MultipleOutputs::Check()
void
MultipleOutputs
::
Pause
()
{
Update
();
Update
(
false
);
for
(
auto
ao
:
outputs
)
ao
->
LockPauseAsync
();
...
...
src/output/MultipleOutputs.hxx
View file @
db95aa25
...
...
@@ -237,19 +237,12 @@ private:
void
AllowPlay
();
/**
* Resets the "reopen" flag on all audio devices. MPD should
* immediately retry to open the device instead of waiting for
* the timeout when the user wants to start playback.
*/
void
ResetReopen
();
/**
* Opens all output devices which are enabled, but closed.
*
* @return true if there is at least open output device which
* is open
*/
bool
Update
();
bool
Update
(
bool
force
);
/**
* Has this chunk been consumed by all audio outputs?
...
...
src/output/OutputControl.cxx
View file @
db95aa25
...
...
@@ -159,12 +159,13 @@ AudioOutput::CloseWait()
bool
AudioOutput
::
LockUpdate
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
mp
)
const
MusicPipe
&
mp
,
bool
force
)
{
const
ScopeLock
protect
(
mutex
);
if
(
enabled
&&
really_enabled
)
{
if
(
!
fail_timer
.
IsDefined
()
||
if
(
force
||
!
fail_timer
.
IsDefined
()
||
fail_timer
.
Check
(
REOPEN_AFTER
*
1000
))
{
return
Open
(
audio_format
,
mp
);
}
...
...
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