kopia lustrzana https://github.com/ge0rg/aprsdroid
fix read()=0 error message at stop
rodzic
7c71ae1e5c
commit
25f6a3952c
|
@ -27,7 +27,7 @@ class AfskDemodulator(au : AfskUploader, samplerate : Int) extends Thread("AFSK
|
||||||
Log.d(TAG, "running...")
|
Log.d(TAG, "running...")
|
||||||
try {
|
try {
|
||||||
recorder.startRecording();
|
recorder.startRecording();
|
||||||
while (recorder.getRecordingState() != AudioRecord.RECORDSTATE_STOPPED) {
|
while (!isInterrupted() && (recorder.getRecordingState() != AudioRecord.RECORDSTATE_STOPPED)) {
|
||||||
val count = recorder.read(buffer_s, 0, BUF_SIZE)
|
val count = recorder.read(buffer_s, 0, BUF_SIZE)
|
||||||
Log.d(TAG, "read " + count + " samples")
|
Log.d(TAG, "read " + count + " samples")
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
|
@ -49,7 +49,9 @@ class AfskDemodulator(au : AfskUploader, samplerate : Int) extends Thread("AFSK
|
||||||
|
|
||||||
def close() {
|
def close() {
|
||||||
try {
|
try {
|
||||||
|
this.interrupt()
|
||||||
recorder.stop()
|
recorder.stop()
|
||||||
|
this.join(50)
|
||||||
} catch {
|
} catch {
|
||||||
case e : IllegalStateException => Log.w(TAG, "close(): " + e)
|
case e : IllegalStateException => Log.w(TAG, "close(): " + e)
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue