Merge branch 'alsa_input_exception' of https://github.com/borine/MPD

This commit is contained in:
Max Kellermann 2023-12-20 13:21:37 +01:00
commit 7727630f24
1 changed files with 7 additions and 6 deletions

View File

@ -219,7 +219,7 @@ AlsaInputStream::PrepareSockets() noexcept
void void
AlsaInputStream::DispatchSockets() noexcept AlsaInputStream::DispatchSockets() noexcept
{ try {
non_block.DispatchSockets(*this, capture_handle); non_block.DispatchSockets(*this, capture_handle);
const std::scoped_lock<Mutex> protect(mutex); const std::scoped_lock<Mutex> protect(mutex);
@ -238,16 +238,17 @@ AlsaInputStream::DispatchSockets() noexcept
if (n_frames == -EAGAIN) if (n_frames == -EAGAIN)
return; return;
if (Recover(n_frames) < 0) { if (Recover(n_frames) < 0)
postponed_exception = std::make_exception_ptr(std::runtime_error("PCM error - stream aborted")); throw std::runtime_error("PCM error - stream aborted");
InvokeOnAvailable();
return;
}
} }
size_t nbytes = n_frames * frame_size; size_t nbytes = n_frames * frame_size;
CommitWriteBuffer(nbytes); CommitWriteBuffer(nbytes);
} }
catch (...) {
postponed_exception = std::current_exception();
InvokeOnAvailable();
}
inline int inline int
AlsaInputStream::Recover(int err) AlsaInputStream::Recover(int err)