]> git.sesse.net Git - nageru/commitdiff
Fix an issue where an ALSA card that was dead on boot could not be plugged in.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 24 Apr 2018 18:19:23 +0000 (20:19 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 24 Apr 2018 18:19:23 +0000 (20:19 +0200)
alsa_input.cpp
alsa_pool.cpp

index 7230abeecd10839c8bcbb84c87a40d9c18115747..08a67f7fa7837ccabeb18a414eeaacf61d404bb3 100644 (file)
@@ -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);
 }
index 59ae595f029f8ba6cfef0d7aff12f88a97f61799..3092dc32335551deed1b2b7b2255c07b7e9a19db 100644 (file)
@@ -391,6 +391,10 @@ void ALSAPool::reset_device(unsigned index)
 {
        lock_guard<mutex> 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();
        }