Internal change

PiperOrigin-RevId: 497043596
This commit is contained in:
MediaPipe Team 2022-12-21 17:39:54 -08:00 committed by Copybara-Service
parent c8b8d1fe6b
commit 69b6d9d970

View File

@ -1028,7 +1028,9 @@ export class GraphRunner {
// Set up our TS listener to receive any packets for this stream, and // Set up our TS listener to receive any packets for this stream, and
// additionally reformat our Uint8Array into a Float32Array for the user. // additionally reformat our Uint8Array into a Float32Array for the user.
this.setListener(outputStreamName, (data: Uint8Array) => { this.setListener(outputStreamName, (data: Uint8Array) => {
const floatArray = new Float32Array(data.buffer); // Should be very fast // Should be very fast
const floatArray =
new Float32Array(data.buffer, data.byteOffset, data.length / 4);
callbackFcn(floatArray); callbackFcn(floatArray);
}); });