mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Address review comments, fix quality check issues.
This commit is contained in:
parent
155842f8bc
commit
2fbec133b6
2 changed files with 6 additions and 11 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue