diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-05-04 16:05:47 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-05-04 16:05:47 +0200 |
commit | 55fe285c56055497725a619e5b9acbd6dec57e23 (patch) | |
tree | ee9fc752adddd8ef75b4e2c94c0e8ef914411c28 /src/AlsaInput.cpp | |
parent | 20607d9aff6b1cee10fec1c7efc815ae2d77518c (diff) | |
download | ODR-AudioEnc-55fe285c56055497725a619e5b9acbd6dec57e23.tar.gz ODR-AudioEnc-55fe285c56055497725a619e5b9acbd6dec57e23.tar.bz2 ODR-AudioEnc-55fe285c56055497725a619e5b9acbd6dec57e23.zip |
Fix teardown after silence detector trigger
Diffstat (limited to 'src/AlsaInput.cpp')
-rw-r--r-- | src/AlsaInput.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/AlsaInput.cpp b/src/AlsaInput.cpp index 0d3b40e..442304c 100644 --- a/src/AlsaInput.cpp +++ b/src/AlsaInput.cpp @@ -31,6 +31,9 @@ using namespace std; AlsaInput::~AlsaInput() { + // Ensures push() doesn't get blocked + m_queue.clear(); + if (m_alsa_handle) { snd_pcm_close(m_alsa_handle); m_alsa_handle = nullptr; @@ -123,6 +126,18 @@ ssize_t AlsaInput::m_read(uint8_t* buf, snd_pcm_uframes_t length) return err; } +AlsaInputThreaded::~AlsaInputThreaded() +{ + m_running = false; + + // Ensures push() doesn't get blocked + m_queue.clear(); + + if (m_thread.joinable()) { + m_thread.join(); + } +} + void AlsaInputThreaded::prepare() { if (m_fault) { |