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
ae7fcf4c
Commit
ae7fcf4c
authored
7 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Thread: move common code to method Failure()
parent
16077547
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
17 deletions
+15
-17
Control.hxx
src/output/Control.hxx
+11
-0
Thread.cxx
src/output/Thread.cxx
+4
-17
No files found.
src/output/Control.hxx
View file @
ae7fcf4c
...
...
@@ -421,6 +421,17 @@ public:
private
:
/**
* An error has occurred and this output is defunct.
*/
void
Failure
(
std
::
exception_ptr
e
)
noexcept
{
last_error
=
e
;
/* don't automatically reopen this device for 10
seconds */
fail_timer
.
Update
();
}
/**
* Runs inside the OutputThread.
* Caller must lock the mutex.
* Handles exceptions.
...
...
This diff is collapsed.
Click to expand it.
src/output/Thread.cxx
View file @
ae7fcf4c
...
...
@@ -109,8 +109,7 @@ AudioOutputControl::InternalEnable() noexcept
return
true
;
}
catch
(...)
{
LogError
(
std
::
current_exception
());
fail_timer
.
Update
();
last_error
=
std
::
current_exception
();
Failure
(
std
::
current_exception
());
return
false
;
}
}
...
...
@@ -162,8 +161,7 @@ AudioOutputControl::InternalOpen(const AudioFormat in_audio_format,
}
}
catch
(...)
{
LogError
(
std
::
current_exception
());
fail_timer
.
Update
();
last_error
=
std
::
current_exception
();
Failure
(
std
::
current_exception
());
}
if
(
f
!=
in_audio_format
||
f
!=
output
->
out_audio_format
)
...
...
@@ -234,13 +232,8 @@ try {
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
"Failed to filter for %s"
,
GetLogName
());
last_error
=
std
::
current_exception
();
Failure
(
std
::
current_exception
());
InternalClose
(
false
);
/* don't automatically reopen this device for 10
seconds */
fail_timer
.
Update
();
return
false
;
}
...
...
@@ -280,15 +273,9 @@ AudioOutputControl::PlayChunk() noexcept
}
catch
(...)
{
FormatError
(
std
::
current_exception
(),
"Failed to play on %s"
,
GetLogName
());
last_error
=
std
::
current_exception
(
);
Failure
(
std
::
current_exception
()
);
InternalClose
(
false
);
/* don't automatically reopen this device for
10 seconds */
assert
(
!
fail_timer
.
IsDefined
());
fail_timer
.
Update
();
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
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