mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
refactor: simplify duration calculation by returning muxer directly
This commit is contained in:
1 parent
5129ee5ecc
commit
952924cdd5
1 file changed
+4
-6
@@ -321,9 +321,8 @@ const StreamPipeline = {
|
||||
pcmStream.on("data", (chunk) => { pcmBytes += chunk.length; });
|
||||
|
||||
pcmStream.pipe(encoder).pipe(muxer);
|
||||
const wrapper = Object.create(muxer);
|
||||
wrapper.getDurationMs = () => Math.round((pcmBytes / (PCM_RATE * PCM_CHANNELS * 2)) * 1000);
|
||||
return wrapper;
|
||||
muxer.getDurationMs = () => Math.round((pcmBytes / (PCM_RATE * PCM_CHANNELS * 2)) * 1000);
|
||||
return muxer;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -437,9 +436,8 @@ const StreamPipeline = {
|
||||
});
|
||||
oggStream.pipe(demuxer).pipe(muxer);
|
||||
await headPromise;
|
||||
const wrapper = Object.create(muxer);
|
||||
wrapper.getDurationMs = () => frameCount * OPUS_FRAME_MS;
|
||||
return wrapper;
|
||||
muxer.getDurationMs = () => frameCount * OPUS_FRAME_MS;
|
||||
return muxer;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user