From 2c4ee7eb15257ab7020953b1c6709cd51fe270df Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Mon, 8 Aug 2022 14:06:04 +0200 Subject: [PATCH] Increase max length of voice messages to 15m (PSG-661) (#9133) * Increase max length of voice messages to 15m (PSG-661) Relates to: vector-im/element-ios#5415 Signed-off-by: Johannes Marbach * Fix comment Signed-off-by: Johannes Marbach * Update src/audio/VoiceRecording.ts Co-authored-by: Robin Co-authored-by: Robin --- src/audio/VoiceRecording.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/audio/VoiceRecording.ts b/src/audio/VoiceRecording.ts index 1c6c8b40d2..d0b34493d8 100644 --- a/src/audio/VoiceRecording.ts +++ b/src/audio/VoiceRecording.ts @@ -37,7 +37,7 @@ import mxRecorderWorkletPath from "./RecorderWorklet"; const CHANNELS = 1; // stereo isn't important export const SAMPLE_RATE = 48000; // 48khz is what WebRTC uses. 12khz is where we lose quality. const BITRATE = 24000; // 24kbps is pretty high quality for our use case in opus. -const TARGET_MAX_LENGTH = 120; // 2 minutes in seconds. Somewhat arbitrary, though longer == larger files. +const TARGET_MAX_LENGTH = 900; // 15 minutes in seconds. Somewhat arbitrary, though longer == larger files. const TARGET_WARN_TIME_LEFT = 10; // 10 seconds, also somewhat arbitrary. export const RECORDING_PLAYBACK_SAMPLES = 44; @@ -229,8 +229,8 @@ export class VoiceRecording extends EventEmitter implements IDestroyable { // go horribly over the limit. We also emit a warning state if needed. // // We use the recorder's perspective of time to make sure we don't cut off the last - // frame of audio, otherwise we end up with a 1:59 clip (119.68 seconds). This extra - // safety can allow us to overshoot the target a bit, but at least when we say 2min + // frame of audio, otherwise we end up with a 14:59 clip (899.68 seconds). This extra + // safety can allow us to overshoot the target a bit, but at least when we say 15min // maximum we actually mean it. // // In testing, recorder time and worker time lag by about 400ms, which is roughly the