Skip to content
Snippets Groups Projects
Commit cdf0ec6b authored by SeeLook's avatar SeeLook
Browse files

Android: Fixed hang on, when app was exiting and audio input was active

parent 9be712d6
No related branches found
No related tags found
No related merge requests found
...@@ -55,7 +55,7 @@ TaudioIN::TaudioIN(TaudioParams* params, QObject *parent) : ...@@ -55,7 +55,7 @@ TaudioIN::TaudioIN(TaudioParams* params, QObject *parent) :
m_instance = this; m_instance = this;
finder()->setCopyInThread(false); finder()->setCopyInThread(false);
finder()->setNrChunksToReset(500); // Less memory usage finder()->setNrChunksToReset(500); // Less memory usage
createInputDevice(); createInputDevice();
moveToThread(m_thread); moveToThread(m_thread);
...@@ -68,13 +68,14 @@ TaudioIN::~TaudioIN() { ...@@ -68,13 +68,14 @@ TaudioIN::~TaudioIN() {
stopListening(); stopListening();
m_audioIN->stop(); m_audioIN->stop();
finder()->blockSignals(true); finder()->blockSignals(true);
if (m_thread->isRunning()) { if (m_thread->isRunning()) { // In fact, it never goes here
m_thread->wait(10); qDebug() << "Terminating audio input thread";
m_thread->terminate(); m_thread->terminate();
m_thread->quit(); m_thread->quit();
stopThread();
} }
m_audioParams->INdevName = m_deviceName; // store device name at the app exit m_audioParams->INdevName = m_deviceName; // store device name at the app exit
m_thread->deleteLater(); delete m_thread;
m_instance = 0; m_instance = 0;
} }
...@@ -153,14 +154,14 @@ void TaudioIN::startThread() { ...@@ -153,14 +154,14 @@ void TaudioIN::startThread() {
void TaudioIN::stopThread() { void TaudioIN::stopThread() {
// if (detectingState() != e_stopped) { m_audioIN->stop();
m_audioIN->stop(); if (m_buffer) {
delete m_buffer; delete m_buffer;
m_buffer = 0; m_buffer = 0;
resetVolume(); }
resetChunkPitch(); resetVolume();
finder()->resetFinder(); resetChunkPitch();
// } finder()->resetFinder();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment