From b874584cf7db9146bf7f34301b77a1440097564f Mon Sep 17 00:00:00 2001 From: edr Date: Wed, 20 Mar 2024 20:14:45 +0100 Subject: [PATCH] Fix wrong success state upon reading zero bytes --- app/src/main/kotlin/de/rochefort/childmonitor/ListenService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/de/rochefort/childmonitor/ListenService.kt b/app/src/main/kotlin/de/rochefort/childmonitor/ListenService.kt index 8789def..59400ff 100644 --- a/app/src/main/kotlin/de/rochefort/childmonitor/ListenService.kt +++ b/app/src/main/kotlin/de/rochefort/childmonitor/ListenService.kt @@ -176,7 +176,8 @@ class ListenService : Service() { while (!Thread.currentThread().isInterrupted) { val len = inputStream.read(readBuffer) if (len < 0) { - return true + // If the current thread was not interrupted this means the remote stopped streaming + return Thread.currentThread().isInterrupted } val decoded: Int = AudioCodecDefines.CODEC.decode(decodedBuffer, readBuffer, len, 0) if (decoded > 0) {