@omote/core 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1885,18 +1885,19 @@ var _A2EProcessor = class _A2EProcessor {
|
|
|
1885
1885
|
*/
|
|
1886
1886
|
async flush() {
|
|
1887
1887
|
if (this.disposed || this.writeOffset === 0) return;
|
|
1888
|
+
const actualSamples = this.writeOffset;
|
|
1888
1889
|
const padded = new Float32Array(this.chunkSize);
|
|
1889
|
-
padded.set(this.buffer.subarray(0,
|
|
1890
|
+
padded.set(this.buffer.subarray(0, actualSamples), 0);
|
|
1890
1891
|
const chunkTimestamp = this.bufferStartTime > 0 ? this.bufferStartTime : void 0;
|
|
1891
1892
|
logger4.info("flush: routing through drain pipeline", {
|
|
1892
|
-
actualSamples
|
|
1893
|
+
actualSamples,
|
|
1893
1894
|
chunkTimestamp: chunkTimestamp?.toFixed(3),
|
|
1894
1895
|
pendingChunks: this.pendingChunks.length,
|
|
1895
1896
|
inferenceRunning: this.inferenceRunning
|
|
1896
1897
|
});
|
|
1897
1898
|
this.writeOffset = 0;
|
|
1898
1899
|
this.bufferStartTime = 0;
|
|
1899
|
-
this.pendingChunks.push({ chunk: padded, timestamp: chunkTimestamp });
|
|
1900
|
+
this.pendingChunks.push({ chunk: padded, timestamp: chunkTimestamp, actualSamples });
|
|
1900
1901
|
this.drainPendingChunks();
|
|
1901
1902
|
}
|
|
1902
1903
|
/**
|
|
@@ -2054,14 +2055,15 @@ var _A2EProcessor = class _A2EProcessor {
|
|
|
2054
2055
|
logger4.info("drainPendingChunks starting", { pendingChunks: this.pendingChunks.length });
|
|
2055
2056
|
const processNext = async () => {
|
|
2056
2057
|
while (this.pendingChunks.length > 0 && !this.disposed) {
|
|
2057
|
-
const { chunk, timestamp } = this.pendingChunks.shift();
|
|
2058
|
+
const { chunk, timestamp, actualSamples } = this.pendingChunks.shift();
|
|
2058
2059
|
try {
|
|
2059
2060
|
const t0 = getClock().now();
|
|
2060
2061
|
const result = await this.backend.infer(chunk, this.identityIndex);
|
|
2061
2062
|
const inferMs = Math.round(getClock().now() - t0);
|
|
2062
|
-
const
|
|
2063
|
+
const effectiveSamples = actualSamples ?? chunk.length;
|
|
2064
|
+
const actualDuration = effectiveSamples / this.sampleRate;
|
|
2063
2065
|
const actualFrameCount = Math.ceil(actualDuration * FRAME_RATE);
|
|
2064
|
-
const framesToQueue = Math.min(actualFrameCount, result.blendshapes.length);
|
|
2066
|
+
const framesToQueue = Math.min(Math.max(1, actualFrameCount), result.blendshapes.length);
|
|
2065
2067
|
logger4.info("Inference complete", {
|
|
2066
2068
|
inferMs,
|
|
2067
2069
|
modelFrames: result.blendshapes.length,
|