From 4a300e3cab7b1b1ef5a32e1f4a7ec319c48e95e5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 24 Apr 2018 20:19:23 +0200 Subject: [PATCH] Fix an issue where an ALSA card that was dead on boot could not be plugged in. --- alsa_input.cpp | 1 + alsa_pool.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/alsa_input.cpp b/alsa_input.cpp index 7230abe..08a67f7 100644 --- a/alsa_input.cpp +++ b/alsa_input.cpp @@ -158,6 +158,7 @@ ALSAInput::~ALSAInput() void ALSAInput::start_capture_thread() { + assert(!device.empty()); should_quit.unquit(); capture_thread = thread(&ALSAInput::capture_thread_func, this); } diff --git a/alsa_pool.cpp b/alsa_pool.cpp index 59ae595..3092dc3 100644 --- a/alsa_pool.cpp +++ b/alsa_pool.cpp @@ -391,6 +391,10 @@ void ALSAPool::reset_device(unsigned index) { lock_guard lock(mu); Device *device = &devices[index]; + if (device->state == Device::State::DEAD) { + // Not running, and should not be started. + return; + } if (inputs[index] != nullptr) { inputs[index]->stop_capture_thread(); } -- 2.39.2