Compare commits

...

1 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
7b9af07a6b fix(local-recording) defend against out of order events
We have observed some failed recordings which are lacking the EBML
header. The only way in which that seems plausible is if the
dataavailable event is received while processing the stop event. This is
allegedly not possible, but it's the only plausible explanation, so
let's defend against that.

Extend the timeslice back to 5s too.
2025-05-28 11:27:17 -05:00

View File

@@ -10,6 +10,7 @@ import { isMobileBrowser } from '../../../base/environment/utils';
import { browser } from '../../../base/lib-jitsi-meet';
import { isEmbedded } from '../../../base/util/embedUtils';
import { stopLocalVideoRecording } from '../../actions.any';
import logger from '../../logger';
interface ISelfRecording {
on: boolean;
@@ -251,7 +252,7 @@ const LocalRecordingManager: ILocalRecordingManager = {
});
this.recorder.addEventListener('dataavailable', async e => {
if (e.data && e.data.size > 0) {
if (this.recorder && e.data && e.data.size > 0) {
let data = e.data;
if (!this.firstChunk) {
@@ -281,11 +282,13 @@ const LocalRecordingManager: ILocalRecordingManager = {
if (this.writableStream) {
try {
await this.writableStream.seek(0);
await this.writableStream.write(await fixDuration(this.firstChunk!, duration));
if (this.firstChunk) {
await this.writableStream.seek(0);
await this.writableStream.write(await fixDuration(this.firstChunk!, duration));
}
await this.writableStream.close();
} catch (_) {
// Ignored, not much we can do here.
} catch (e) {
logger.error('Error while writing to the local recording file', e);
} finally {
this.firstChunk = undefined;
this.fileHandle = undefined;
@@ -304,7 +307,7 @@ const LocalRecordingManager: ILocalRecordingManager = {
});
}
this.recorder.start(1000);
this.recorder.start(5000);
},
/**