From c24c704439dd63e4c542fef1a12e1595dc07aefa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 27 Jan 2025 19:53:03 +0800 Subject: [PATCH] fix: clone object --- src/common/ffmpeg-worker.ts | 8 ++++---- src/common/ffmpeg.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/ffmpeg-worker.ts b/src/common/ffmpeg-worker.ts index 5803c125..7ee7b2d8 100644 --- a/src/common/ffmpeg-worker.ts +++ b/src/common/ffmpeg-worker.ts @@ -67,7 +67,7 @@ import imageSize from 'image-size'; } } - public static async convert(filePath: string, pcmPath: string, logger: LogWrapper): Promise { + public static async convert(filePath: string, pcmPath: string): Promise { const ffmpegInstance = await FFmpeg.create({ core: '@ffmpeg.wasm/core-mt' }); const inputFileName = `${randomUUID()}.input`; const outputFileName = `${randomUUID()}.pcm`; @@ -87,12 +87,12 @@ import imageSize from 'image-size'; try { ffmpegInstance.fs.unlink(outputFileName); } catch (unlinkError) { - logger.log('Error unlinking output file:', unlinkError); + console.error('Error unlinking output file:', unlinkError); } try { ffmpegInstance.fs.unlink(inputFileName); } catch (unlinkError) { - logger.log('Error unlinking input file:', unlinkError); + console.error('Error unlinking output file:', unlinkError); } } } @@ -142,7 +142,7 @@ export default async function handleFFmpegTask({ method, args }: FFmpegTask): Pr case 'convertFile': return await FFmpegService.convertFile(...args as [string, string, string]); case 'convert': - return await FFmpegService.convert(...args as [string, string, LogWrapper]); + return await FFmpegService.convert(...args as [string, string]); case 'getVideoInfo': return await FFmpegService.getVideoInfo(...args as [string, string]); default: diff --git a/src/common/ffmpeg.ts b/src/common/ffmpeg.ts index e026a2b9..efc72571 100644 --- a/src/common/ffmpeg.ts +++ b/src/common/ffmpeg.ts @@ -30,11 +30,11 @@ export class FFmpegService { await piscina.destroy(); } - public static async convert(filePath: string, pcmPath: string, logger: LogWrapper): Promise { + public static async convert(filePath: string, pcmPath: string): Promise { const piscina = new Piscina({ filename: await getWorkerPath(), }); - const result = await piscina.run({ method: 'convert', args: [filePath, pcmPath, logger] }); + const result = await piscina.run({ method: 'convert', args: [filePath, pcmPath] }); await piscina.destroy(); return result; }