style: format recorder modules
This commit is contained in:
@@ -22,7 +22,8 @@ export class OpusDecoder {
|
|||||||
this.onData = options.onData;
|
this.onData = options.onData;
|
||||||
this.createDecoderFn =
|
this.createDecoderFn =
|
||||||
options.createDecoder ??
|
options.createDecoder ??
|
||||||
(() => new prism.opus.Decoder({ frameSize: 960, channels: 2, rate: 48000 }));
|
(() =>
|
||||||
|
new prism.opus.Decoder({ frameSize: 960, channels: 2, rate: 48000 }));
|
||||||
}
|
}
|
||||||
|
|
||||||
rotateIfNeeded(): void {
|
rotateIfNeeded(): void {
|
||||||
@@ -38,7 +39,10 @@ export class OpusDecoder {
|
|||||||
try {
|
try {
|
||||||
decoder.write(chunk);
|
decoder.write(chunk);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn("[recorder] Opus decoder write failed, cooling down:", error);
|
console.warn(
|
||||||
|
"[recorder] Opus decoder write failed, cooling down:",
|
||||||
|
error,
|
||||||
|
);
|
||||||
this.coolDown();
|
this.coolDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ export async function collectUserMetadata(
|
|||||||
member?.roles.cache
|
member?.roles.cache
|
||||||
.filter((role) => role.id !== channel.guild.id)
|
.filter((role) => role.id !== channel.guild.id)
|
||||||
.sort((a, b) => b.position - a.position)
|
.sort((a, b) => b.position - a.position)
|
||||||
.map((role) => ({ id: role.id, name: role.name, position: role.position })) ??
|
.map((role) => ({
|
||||||
[];
|
id: role.id,
|
||||||
|
name: role.name,
|
||||||
|
position: role.position,
|
||||||
|
})) ?? [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userId,
|
userId,
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ export class SegmentManager {
|
|||||||
open(oggPacketStream: NodeJS.ReadableStream): SegmentState {
|
open(oggPacketStream: NodeJS.ReadableStream): SegmentState {
|
||||||
const index = this.segmentIndex++;
|
const index = this.segmentIndex++;
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
const { filename, jsonFilename } = buildSegmentPaths(this.userDir, startTime);
|
const { filename, jsonFilename } = buildSegmentPaths(
|
||||||
|
this.userDir,
|
||||||
|
startTime,
|
||||||
|
);
|
||||||
const oggStream = new prism.opus.OggLogicalBitstream({
|
const oggStream = new prism.opus.OggLogicalBitstream({
|
||||||
opusHead: new prism.opus.OpusHead({ channelCount: 2, sampleRate: 48000 }),
|
opusHead: new prism.opus.OpusHead({ channelCount: 2, sampleRate: 48000 }),
|
||||||
pageSizeControl: { maxPackets: 10 },
|
pageSizeControl: { maxPackets: 10 },
|
||||||
|
|||||||
Reference in New Issue
Block a user