mirror of
https://github.com/element-hq/element-android
synced 2024-11-23 18:05:36 +03:00
Compute max file size from chunk length
This commit is contained in:
parent
64e6a2bfab
commit
9d35e81db7
3 changed files with 4 additions and 4 deletions
|
@ -34,8 +34,8 @@ abstract class AbstractVoiceRecorderQ(private val context: Context) : AbstractVo
|
|||
protected var nextOutputFile: File? = null
|
||||
|
||||
private val audioSource: Int = MediaRecorder.AudioSource.DEFAULT
|
||||
private val audioEncodingBitRate: Int = 24_000
|
||||
private val audioSamplingRate: Int = 48_000
|
||||
protected val audioEncodingBitRate: Int = 24_000
|
||||
|
||||
abstract val outputFormat: Int // see MediaRecorder.OutputFormat
|
||||
abstract val audioEncoder: Int // see MediaRecorder.AudioEncoder
|
||||
|
|
|
@ -22,5 +22,5 @@ object VoiceBroadcastConstants {
|
|||
const val STATE_ROOM_VOICE_BROADCAST_INFO = "io.element.voice_broadcast_info"
|
||||
|
||||
/** Default voice broadcast chunk duration, in seconds */
|
||||
const val DEFAULT_CHUNK_LENGTH = 5
|
||||
const val DEFAULT_CHUNK_LENGTH = 30
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class VoiceBroadcastRecorderQ(
|
|||
context: Context,
|
||||
) : AbstractVoiceRecorderQ(context), VoiceBroadcastRecorder {
|
||||
|
||||
private var maxFileSize = 25_000L // 0,025 Mb = 25 Kb ~= 6s
|
||||
private var maxFileSize = 0L // zero or negative for no limit
|
||||
|
||||
override var listener: VoiceBroadcastRecorder.Listener? = null
|
||||
|
||||
|
@ -50,7 +50,7 @@ class VoiceBroadcastRecorderQ(
|
|||
}
|
||||
|
||||
override fun startRecord(roomId: String, chunkLength: Int) {
|
||||
maxFileSize = (chunkLength * 0.004166).toLong() // TODO change this approximate conversion
|
||||
maxFileSize = (chunkLength * audioEncodingBitRate / 8).toLong()
|
||||
startRecord(roomId)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue