diff --git a/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java b/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java index 6befb666..fd4e15c9 100644 --- a/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java +++ b/app/src/main/java/org/lineageos/recorder/service/HighQualityRecorder.java @@ -154,7 +154,7 @@ private void recordingThreadImpl() { // Status indicates the number of bytes if (status != 0) { if (mTrackAmplitude.get()) { - for (int i = 0; i < data.length; i = i + 2) { + for (int i = 0; i < status; i = i + 2) { int value = data[i] & 0xff | data[i + 1] << 8; if (value < 0) { value = -value; @@ -164,7 +164,7 @@ private void recordingThreadImpl() { } } } - out.write(data, 0, BUFFER_SIZE_IN_BYTES); + out.write(data, 0, status); } } } catch (IOException e) {