Commit b93e3b2c authored by Max Kellermann's avatar Max Kellermann

output/Thread: move code to method InternalCloseError()

parent ae7fcf4c
...@@ -467,6 +467,14 @@ private: ...@@ -467,6 +467,14 @@ private:
void InternalClose(bool drain) noexcept; 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. * Runs inside the OutputThread.
* Caller must lock the mutex. * Caller must lock the mutex.
*/ */
......
...@@ -232,8 +232,7 @@ try { ...@@ -232,8 +232,7 @@ try {
} catch (...) { } catch (...) {
FormatError(std::current_exception(), FormatError(std::current_exception(),
"Failed to filter for %s", GetLogName()); "Failed to filter for %s", GetLogName());
Failure(std::current_exception()); InternalCloseError(std::current_exception());
InternalClose(false);
return false; return false;
} }
...@@ -273,9 +272,7 @@ AudioOutputControl::PlayChunk() noexcept ...@@ -273,9 +272,7 @@ AudioOutputControl::PlayChunk() noexcept
} catch (...) { } catch (...) {
FormatError(std::current_exception(), FormatError(std::current_exception(),
"Failed to play on %s", GetLogName()); "Failed to play on %s", GetLogName());
Failure(std::current_exception()); InternalCloseError(std::current_exception());
InternalClose(false);
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment