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 <johannesm@element.io>

* Fix comment

Signed-off-by: Johannes Marbach <johannesm@element.io>

* Update src/audio/VoiceRecording.ts

Co-authored-by: Robin <robin@robin.town>

Co-authored-by: Robin <robin@robin.town>
pull/28217/head
Johannes Marbach 2022-08-08 14:06:04 +02:00 committed by GitHub
parent cb15222594
commit 2c4ee7eb15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,7 @@ import mxRecorderWorkletPath from "./RecorderWorklet";
const CHANNELS = 1; // stereo isn't important const CHANNELS = 1; // stereo isn't important
export const SAMPLE_RATE = 48000; // 48khz is what WebRTC uses. 12khz is where we lose quality. 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 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. const TARGET_WARN_TIME_LEFT = 10; // 10 seconds, also somewhat arbitrary.
export const RECORDING_PLAYBACK_SAMPLES = 44; 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. // 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 // 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 // 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 2min // safety can allow us to overshoot the target a bit, but at least when we say 15min
// maximum we actually mean it. // maximum we actually mean it.
// //
// In testing, recorder time and worker time lag by about 400ms, which is roughly the // In testing, recorder time and worker time lag by about 400ms, which is roughly the