diff options
author | Andrew Comminos <andrew@comminos.com> | 2016-09-20 11:10:10 +0300 |
---|---|---|
committer | Andrew Comminos <andrew@comminos.com> | 2016-09-20 11:10:10 +0300 |
commit | 4de76b7395cee235cd4f537ec295b3c9bdc2ba50 (patch) | |
tree | 161f6fbcb0ca8175692f8cc181b486623981478e /src/main/java/com/morlunk | |
parent | 5f01718069ad4557088c902164ca04a90992ab72 (diff) |
Consolidate record thread shutdown.
Diffstat (limited to 'src/main/java/com/morlunk')
-rw-r--r-- | src/main/java/com/morlunk/jumble/audio/AudioInput.java | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/main/java/com/morlunk/jumble/audio/AudioInput.java b/src/main/java/com/morlunk/jumble/audio/AudioInput.java index 7a6da29..5fc9609 100644 --- a/src/main/java/com/morlunk/jumble/audio/AudioInput.java +++ b/src/main/java/com/morlunk/jumble/audio/AudioInput.java @@ -109,6 +109,7 @@ public class AudioInput implements Runnable { if(!mRecording) return; mRecording = false; try { + mRecordThread.interrupt(); mRecordThread.join(); mRecordThread = null; } catch (InterruptedException e) { @@ -122,19 +123,7 @@ public class AudioInput implements Runnable { * NOTE: It is not safe to call startRecording after. */ public void shutdown() { - if(mRecording) { - mRecording = false; - try { - // Interrupt so that we stop waiting on the PTT CV. - mRecordThread.interrupt(); - mRecordThread.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - mRecordThread = null; - + stopRecording(); if(mAudioRecord != null) { mAudioRecord.release(); mAudioRecord = null; |