MCPcopy Create free account
hub / github.com/NVIDIA/personaplex / sendInitCommand

Function sendInitCommand

client/src/decoder/decoderWorker.ts:55–73  ·  view source on GitHub ↗
(worker: Worker, audioContextSampleRate: number)

Source from the content-addressed store, hash-verified

53
54// Send init command to a worker, then send warmup BOS page
55const sendInitCommand = (worker: Worker, audioContextSampleRate: number): void => {
56 worker.postMessage({
57 command: "init",
58 bufferLength: 960 * audioContextSampleRate / 24000,
59 decoderSampleRate: 24000,
60 outputBufferSampleRate: audioContextSampleRate,
61 resampleQuality: 0,
62 });
63
64 // After a short delay, send warmup BOS page to trigger decoder's internal init
65 setTimeout(() => {
66 const bosPage = createWarmupBosPage();
67 console.log("Sending warmup BOS page to decoder");
68 worker.postMessage({
69 command: "decode",
70 pages: bosPage,
71 });
72 }, 100);
73};
74
75// Singleton pre-warmed worker that starts loading WASM immediately
76let prewarmedWorker: Worker | null = null;

Callers 2

prewarmDecoderWorkerFunction · 0.85
initDecoderFunction · 0.85

Calls 2

createWarmupBosPageFunction · 0.85
logMethod · 0.45

Tested by

no test coverage detected