diff --git a/src/input/plugins/AlsaInputPlugin.cxx b/src/input/plugins/AlsaInputPlugin.cxx index d76359833..ba940cce9 100644 --- a/src/input/plugins/AlsaInputPlugin.cxx +++ b/src/input/plugins/AlsaInputPlugin.cxx @@ -234,7 +234,7 @@ AlsaInputStream::PrepareSockets() noexcept void AlsaInputStream::DispatchSockets() noexcept -{ +try { non_block.DispatchSockets(*this, capture_handle); const std::scoped_lock<Mutex> protect(mutex); @@ -253,16 +253,17 @@ AlsaInputStream::DispatchSockets() noexcept if (n_frames == -EAGAIN) return; - if (Recover(n_frames) < 0) { - postponed_exception = std::make_exception_ptr(std::runtime_error("PCM error - stream aborted")); - InvokeOnAvailable(); - return; - } + if (Recover(n_frames) < 0) + throw std::runtime_error("PCM error - stream aborted"); } size_t nbytes = n_frames * frame_size; CommitWriteBuffer(nbytes); } +catch (...) { + postponed_exception = std::current_exception(); + InvokeOnAvailable(); +} inline int AlsaInputStream::Recover(int err)