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
a72a02f0
Commit
a72a02f0
authored
Jun 08, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Thread: move Enable() call to InternalEnable()
parent
614df963
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
13 deletions
+28
-13
Control.hxx
src/output/Control.hxx
+7
-0
Thread.cxx
src/output/Thread.cxx
+21
-13
No files found.
src/output/Control.hxx
View file @
a72a02f0
...
...
@@ -362,6 +362,13 @@ public:
private
:
/**
* Runs inside the OutputThread. Handles exceptions.
*
* @return true on success
*/
bool
InternalEnable
()
noexcept
;
/**
* Runs inside the OutputThread. Handles exceptions.
*/
void
InternalDisable
()
noexcept
;
...
...
src/output/Thread.cxx
View file @
a72a02f0
...
...
@@ -197,6 +197,22 @@ AudioOutput::OpenOutputAndConvert(AudioFormat desired_audio_format)
}
}
inline
bool
AudioOutputControl
::
InternalEnable
()
noexcept
{
last_error
=
nullptr
;
try
{
output
->
Enable
();
return
true
;
}
catch
(
const
std
::
runtime_error
&
e
)
{
LogError
(
e
);
fail_timer
.
Update
();
last_error
=
std
::
current_exception
();
return
false
;
}
}
inline
void
AudioOutputControl
::
InternalDisable
()
noexcept
{
...
...
@@ -210,14 +226,15 @@ inline void
AudioOutputControl
::
InternalOpen
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
pipe
)
noexcept
{
/* enable the device (just in case the last enable has failed) */
if
(
!
InternalEnable
())
return
;
last_error
=
nullptr
;
fail_timer
.
Reset
();
skip_delay
=
true
;
try
{
/* enable the device (just in case the last enable has failed) */
output
->
Enable
();
output
->
Open
(
audio_format
,
pipe
);
}
catch
(
const
std
::
runtime_error
&
e
)
{
LogError
(
e
);
...
...
@@ -459,16 +476,7 @@ AudioOutputControl::Task()
break
;
case
Command
:
:
ENABLE
:
last_error
=
nullptr
;
try
{
output
->
Enable
();
}
catch
(
const
std
::
runtime_error
&
e
)
{
LogError
(
e
);
fail_timer
.
Update
();
last_error
=
std
::
current_exception
();
}
InternalEnable
();
CommandFinished
();
break
;
...
...
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