output/Thread: move code to method InternalCloseError()

This commit is contained in:
Max Kellermann 2018-01-02 17:15:10 +01:00
parent ae7fcf4c6b
commit b93e3b2cf6
2 changed files with 10 additions and 5 deletions

View File

@ -466,6 +466,14 @@ private:
*/
void InternalClose(bool drain) noexcept;
/**
* An error has occurred, and this output must be closed.
*/
void InternalCloseError(std::exception_ptr e) noexcept {
Failure(e);
InternalClose(false);
}
/**
* Runs inside the OutputThread.
* Caller must lock the mutex.

View File

@ -232,8 +232,7 @@ try {
} catch (...) {
FormatError(std::current_exception(),
"Failed to filter for %s", GetLogName());
Failure(std::current_exception());
InternalClose(false);
InternalCloseError(std::current_exception());
return false;
}
@ -273,9 +272,7 @@ AudioOutputControl::PlayChunk() noexcept
} catch (...) {
FormatError(std::current_exception(),
"Failed to play on %s", GetLogName());
Failure(std::current_exception());
InternalClose(false);
InternalCloseError(std::current_exception());
return false;
}