output/alsa: reset "active" on error
Use the "active" flag in PrepareSockets() instead of LockHasError().
This commit is contained in:
parent
485ed0b156
commit
8a809013f3
|
@ -305,14 +305,10 @@ private:
|
||||||
return frames_written;
|
return frames_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LockHasError() const noexcept {
|
|
||||||
const std::lock_guard<Mutex> lock(mutex);
|
|
||||||
return !!error;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LockCaughtError() noexcept {
|
void LockCaughtError() noexcept {
|
||||||
const std::lock_guard<Mutex> lock(mutex);
|
const std::lock_guard<Mutex> lock(mutex);
|
||||||
error = std::current_exception();
|
error = std::current_exception();
|
||||||
|
active = false;
|
||||||
cond.signal();
|
cond.signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -766,12 +762,11 @@ AlsaOutput::Drain()
|
||||||
|
|
||||||
Activate();
|
Activate();
|
||||||
|
|
||||||
while (drain) {
|
while (drain && active)
|
||||||
if (error)
|
|
||||||
std::rethrow_exception(error);
|
|
||||||
|
|
||||||
cond.wait(mutex);
|
cond.wait(mutex);
|
||||||
}
|
|
||||||
|
if (error)
|
||||||
|
std::rethrow_exception(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
|
@ -866,7 +861,7 @@ AlsaOutput::Play(const void *chunk, size_t size)
|
||||||
std::chrono::steady_clock::duration
|
std::chrono::steady_clock::duration
|
||||||
AlsaOutput::PrepareSockets() noexcept
|
AlsaOutput::PrepareSockets() noexcept
|
||||||
{
|
{
|
||||||
if (LockHasError()) {
|
if (!LockIsActive()) {
|
||||||
ClearSocketList();
|
ClearSocketList();
|
||||||
return std::chrono::steady_clock::duration(-1);
|
return std::chrono::steady_clock::duration(-1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue