From 2fbec133b655c018733c82d4f508c93cae05f539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Mart=C3=ADn?= Date: Tue, 7 Jun 2022 17:14:22 +0200 Subject: [PATCH] Address review comments, fix quality check issues. --- .../im/vector/opusencoder/configuration/SampleRate.kt | 10 +++++----- .../im/vector/app/features/voice/VoiceRecorderL.kt | 7 +------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/library/opusencoder/src/main/java/im/vector/opusencoder/configuration/SampleRate.kt b/library/opusencoder/src/main/java/im/vector/opusencoder/configuration/SampleRate.kt index 70f8590863..e1a8f10725 100644 --- a/library/opusencoder/src/main/java/im/vector/opusencoder/configuration/SampleRate.kt +++ b/library/opusencoder/src/main/java/im/vector/opusencoder/configuration/SampleRate.kt @@ -20,9 +20,9 @@ package im.vector.opusencoder.configuration * Sampling rate of the input signal in Hz. */ sealed class SampleRate private constructor(val value: Int) { - object _8khz : SampleRate(8000) - object _12kHz : SampleRate(12000) - object _16kHz : SampleRate(16000) - object _24KHz : SampleRate(24000) - object _48kHz : SampleRate(48000) + object Rate8khz : SampleRate(8000) + object Rate12kHz : SampleRate(12000) + object Rate16kHz : SampleRate(16000) + object Rate24KHz : SampleRate(24000) + object Rate48kHz : SampleRate(48000) } diff --git a/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt b/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt index 8816ffafbd..f0eed41637 100644 --- a/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt +++ b/vector/src/main/java/im/vector/app/features/voice/VoiceRecorderL.kt @@ -27,7 +27,6 @@ import im.vector.opusencoder.OggOpusEncoder import im.vector.opusencoder.configuration.SampleRate import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job -import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch import org.matrix.android.sdk.api.extensions.tryOrNull @@ -46,7 +45,7 @@ class VoiceRecorderL( ) : VoiceRecorder { companion object { - private val SAMPLE_RATE = SampleRate._48kHz + private val SAMPLE_RATE = SampleRate.Rate48kHz private const val BITRATE = 24 * 1024 } @@ -101,10 +100,6 @@ class VoiceRecorderL( initializeCodec(outputFile.absolutePath) recordingJob = recorderScope.launch { - while (audioRecorder?.state != AudioRecord.STATE_INITIALIZED) { - // If the recorder is not ready let's give it some extra time - delay(10L) - } audioRecorder?.startRecording() val buffer = ShortArray(bufferSizeInShorts)